PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000093. Tìm cặp chỉ số có BCNN nhỏ nhất (Minimum Possible LCM)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Tìm cặp chỉ số có BCNN nhỏ nhất (Minimum Possible LCM)

Minimum Possible LCM

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Given an array aa of nn positive integers indexed from 11 through nn, find two distinct indices i,ji,j such that 1≤i<j≤n1\le i<j\le n and lcm⁡(ai,aj)\operatorname{lcm}(a_i,a_j) is as small as possible among all index pairs. If more than one pair is optimal, print any valid optimal pair.

Input

The first line contains nn. The second line contains nn integers a1,a2,…,ana_1,a_2,\ldots,a_n.

Output

Print two indices i,ji,j with i<ji<j forming an optimal pair.

Subtasks

  • Subtask 1 (20 points): 2≤n≤1002\le n\le100; 1≤ai≤1031\le a_i\le10^3.
  • Subtask 2 (30 points): 2≤n≤50002\le n\le5000; 1≤ai≤1051\le a_i\le10^5.
  • Subtask 3 (50 points): 2≤n≤1062\le n\le10^6; 1≤ai≤1071\le a_i\le10^7.

Examples

Input

5
2 4 8 3 6

Output

1 2

Explanation

Indices 11 and 22 contain 22 and 44, whose LCM is 44. No other pair of distinct indices yields a smaller LCM, so 1 2 is a valid output.