#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e7 + 10;
int cnt[maxn], pos[maxn];
long long Gcd(long long a, long long b) {
  while (b ^= a ^= b ^= a %= b)
    ;
  return a;
}
int main(void) {
  int n, temp, x, y, Max = 0;
  long long ans = 7e18;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &temp);
    cnt[temp]++;
    Max = max(Max, temp);
    if (cnt[temp] > 1 && temp < ans) {
      ans = temp;
      x = pos[temp];
      y = i;
    }
    pos[temp] = i;
  }
  for (int i = 1; i <= Max; i++) {
    int val = 0;
    for (int j = i; j <= Max; j += i) {
      if (!cnt[j])
        continue;
      else if (!val) {
        val = j;
        continue;
      }
      long long gcd = Gcd(1LL * val / i, 1LL * j / i), lcm = 1LL * val / i * j;
      if (gcd == 1 && lcm < ans) ans = lcm, x = pos[val], y = pos[j];
      break;
    }
  }
  printf("%d %d", min(x, y), max(x, y));
  return 0;
}
