#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
struct elem {
  int cnt;
  int lo, hi;
};
int n;
elem a[MAXN];
int main() {
  scanf("%d", &n);
  int x;
  for (int i = 0; i < MAXN; ++i) {
    a[i].cnt = 0;
    a[i].lo = 1e9;
    a[i].hi = -1e9;
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &x);
    a[x].cnt += 1;
    a[x].lo = min(a[x].lo, i);
    a[x].hi = max(a[x].hi, i);
  }
  int len, rlo, rhi;
  len = 1e9;
  int maxC = 0;
  for (int i = 0; i < MAXN; ++i) {
    if (a[i].cnt > maxC || a[i].cnt == maxC && len > a[i].hi - a[i].lo + 1) {
      maxC = a[i].cnt;
      len = a[i].hi - a[i].lo + 1;
      rlo = a[i].lo;
      rhi = a[i].hi;
    }
  }
  cout << rlo << " " << rhi;
  return 0;
}
