#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000005;
int freq[maxn], start[maxn];
int main() {
  int n, d, bestFreq = 0, bestSeg = maxn, l, r;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &d);
    if (freq[d] == 0) start[d] = i;
    ++freq[d];
    if (freq[d] > bestFreq) {
      l = start[d];
      r = i;
      bestFreq = freq[d];
      bestSeg = r - l;
    } else if (freq[d] == bestFreq && bestSeg > i - start[d]) {
      l = start[d];
      r = i;
      bestSeg = r - l;
    }
  }
  printf("%d %d", l, r);
  return 0;
}
