#include <bits/stdc++.h>
using namespace std;
int n;
bool f[10000100];
int index_i, index_j;
int postion[10000100];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  long long mx = 0;
  long long res = 1e15, x;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    mx = max(mx, x);
    if (f[x] == 1) {
      if (res > x) {
        res = x;
        index_i = postion[x];
        index_j = i;
      }
    } else
      f[x] = 1, postion[x] = i;
  }
  for (long long g = 1; g <= mx; g++) {
    int count = 0;
    long long first = 0, second = 0;
    for (int j = g; j <= mx; j += g)
      if (f[j]) {
        count++;
        if (count == 1) first = j;
        if (count == 2) second = j;
      }
    long long tmp = first / g * second;
    if (tmp && res > tmp) {
      res = tmp;
      index_i = postion[first];
      index_j = postion[second];
    }
  }
  if (index_i > index_j) swap(index_i, index_j);
  cout << index_i << " " << index_j << endl;
  return 0;
}
