#include <bits/stdc++.h>
using namespace std;
int firstOccur[1000010];
int secondOccur[1000010];
int cnt[1000010];
int main() {
  int i, j, k, n, v1;
  scanf("%d", &n);
  int mx = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &v1);
    if (firstOccur[v1] == 0) firstOccur[v1] = i + 1;
    secondOccur[v1] = i + 1;
    cnt[v1]++;
    mx = max(mx, cnt[v1]);
  }
  int minD = 100000000;
  int l, r;
  for (i = 1; i <= 1000000; i++) {
    int v1 = i;
    if (mx == cnt[v1]) {
      if (minD > (secondOccur[v1] - firstOccur[v1])) {
        minD = (secondOccur[v1] - firstOccur[v1]);
        l = firstOccur[v1];
        r = secondOccur[v1];
      }
    }
  }
  cout << l << " " << r << endl;
  return 0;
}
