#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, mx = -100000, mn = 1000000000, x, i, lu;
  cin >> n;
  vector<int> cnt(1e6 + 5), l(1e6 + 5);
  for (i = 0; cin >> x; i++) {
    if (cnt[x] == 0) l[x] = i;
    cnt[x]++;
    if (mx < cnt[x])
      mx = cnt[x], lu = l[x], mn = i - lu;
    else if (mx == cnt[x] && mn > i - l[x])
      lu = l[x], mn = i - lu;
  }
  cout << lu + 1 << " " << lu + mn + 1;
}
