#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long flag[10000002];
void oka() {
  long long n, i, j, k, mn, mx = 0, cur, ans = 1e10;
  cin >> n;
  long long a[n];
  long long l, r;
  map<long long, long long> ma;
  map<long long, long long> f, lst;
  for (i = 0; i < n; i++) cin >> a[i], flag[a[i]]++;
  for (i = 0; i < n; i++) {
    if (flag[a[i]] > mx) {
      mx = flag[a[i]];
    }
  }
  for (i = 0; i < n; i++) {
    if (flag[a[i]] == mx) {
      ma[a[i]]++;
      if (ma[a[i]] == 1) f[a[i]] = i;
      if (ma[a[i]] == mx) {
        lst[a[i]] = i;
        mn = lst[a[i]] - f[a[i]];
        if (mn < ans) {
          ans = mn;
          l = f[a[i]];
          r = lst[a[i]];
        }
      }
    }
  }
  cout << l + 1 << " " << r + 1 << endl;
}
int main() {
  long long t;
  t = 1;
  while (t--) {
    oka();
  }
}
