#include <bits/stdc++.h>
using namespace std;
const int dir[4][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
const int mx[8] = {-1, -2, -2, -1, 1, 2, 2, 1};
const int my[8] = {-2, -1, 1, 2, 2, 1, -1, -2};
const double eps = 1e-6;
const double PI = acos(-1.0);
const long long maxn = 1e7 + 5;
const long long inf = 1LL << 62;
int n, num, p1, p2, per1, per2, siz;
long long ans, now0, now1, now2, a[1000005];
bool vis[maxn];
vector<int> vec[maxn];
int main() {
  while (~scanf("%d", &n)) {
    ans = inf;
    per1 = per2 = 0;
    for (long long i = 0LL; i < maxn; ++i) vec[i].clear();
    memset(vis, false, sizeof(vis));
    for (int i = 1; i <= n; ++i) {
      scanf("%lld", &a[i]);
      vec[a[i]].push_back(i);
      vis[a[i]] = true;
    }
    for (long long i = 1LL; i < maxn; ++i) {
      num = 0;
      for (long long j = i; j < maxn && num < 2; j += i) {
        if (!vis[j]) continue;
        if (num == 0) {
          siz = vec[j].size();
          if (siz == 1) {
            ++num;
            p1 = vec[j][0];
            now1 = j;
          } else {
            num += 2;
            p1 = vec[j][0], p2 = vec[j][1];
            now1 = j, now2 = j;
          }
        } else {
          ++num;
          now2 = j;
          p2 = vec[j][0];
        }
      }
      if (num == 2) {
        now0 = now1 / i * now2;
        if (ans > now0) {
          ans = now0;
          per1 = p1, per2 = p2;
        }
      }
    }
    if (per1 > per2) swap(per1, per2);
    printf("%d %d\n", per1, per2);
  }
  return 0;
}
