#include <bits/stdc++.h>
using namespace std;
int n;
const int nmax = 1e7 + 50;
int a[nmax];
int cl[nmax];
long long res = LLONG_MAX;
int i1, i2;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (cl[a[i]] > 0) {
      if (res > a[i]) {
        res = a[i];
        i1 = i;
        i2 = cl[a[i]];
      }
    } else
      cl[a[i]] = i;
  }
  for (int i = 1; i < nmax; i++) {
    if (i > res) break;
    int gt = 0, id = 0;
    for (int j = i; j < nmax; j += i) {
      if (cl[j] == 0) continue;
      if (gt == 0) {
        gt = j;
        id = cl[j];
      } else {
        if (res > 1ll * gt * j / i) {
          res = 1ll * gt * j / i;
          i1 = id;
          i2 = cl[j];
        }
        break;
      }
    }
  }
  if (i1 > i2)
    cout << i2 << ' ' << i1;
  else
    cout << i1 << ' ' << i2;
  return 0;
}
