#include <bits/stdc++.h>
using namespace std;
int l[1000005], r[1000005], cnt[1000005];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    cnt[x]++;
    if (l[x] == 0) l[x] = i;
    r[x] = i;
  }
  int ll, rr, mx = -1, dff = 9999999;
  for (int i = 1; i <= 1000000; i++) {
    if (mx == cnt[i]) {
      if (r[i] - l[i] < dff) {
        ll = l[i];
        rr = r[i];
        dff = r[i] - l[i];
      }
    } else if (cnt[i] > mx) {
      mx = cnt[i];
      ll = l[i];
      rr = r[i];
      dff = r[i] - l[i];
    }
  }
  cout << ll << " " << rr << endl;
  return 0;
}
