#include <bits/stdc++.h>
using namespace std;
int n;
int st[1001000], en[1001000], num[1001000];
int l, r;
int tim;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    ++num[x];
    if (!st[x]) st[x] = i;
    en[x] = i;
  }
  for (int x = 1; x < 1001000; ++x) {
    if (num[x] > tim) {
      tim = num[x];
      l = st[x];
      r = en[x];
    } else if (num[x] == tim) {
      if (en[x] - st[x] < r - l) {
        l = st[x];
        r = en[x];
      }
    }
  }
  printf("%d %d\n", l, r);
  return 0;
}
