#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
int cnt[MAXN];
int start[MAXN];
int main() {
  int n, a, l = 0, r = 0, maxCount = 0;
  memset(cnt, 0, MAXN);
  memset(start, 0, MAXN);
  int minDistance = n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    if (!cnt[a]) {
      start[a] = i;
    }
    ++cnt[a];
    if (maxCount < cnt[a]) {
      maxCount = cnt[a];
      l = start[a];
      r = i;
      minDistance = r - l + 1;
    } else if (maxCount == cnt[a] && i - start[a] + 1 < minDistance) {
      l = start[a];
      r = i;
      minDistance = r - l + 1;
    }
  }
  cout << l + 1 << ' ' << r + 1 << endl;
}
