#include <bits/stdc++.h>
using namespace std;
const int N = 1000000 + 10;
const int INF = 10000000;
int n;
struct Number {
  int L, R, num;
} a[N];
const bool comp(const Number &A, const Number &B) { return A.num > B.num; }
int main() {
  scanf("%d", &n);
  int pos;
  for (int i = 1; i <= N; ++i)
    a[i - 1].L = INF, a[i - 1].R = -INF, a[i - 1].num = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &pos);
    ++a[pos].num;
    a[pos].L = min(i, a[pos].L);
    a[pos].R = max(i, a[pos].R);
  }
  sort(a + 1, a + N, comp);
  int Max = a[1].num, tmp = 1;
  int ans1, ans2, ans3 = INF;
  while (a[tmp].num == Max) {
    if (a[tmp].R - a[tmp].L + 1 < ans3) {
      ans3 = a[tmp].R - a[tmp].L + 1;
      ans1 = a[tmp].L, ans2 = a[tmp].R;
    }
    ++tmp;
  }
  printf("%d %d\n", ans1, ans2);
  return 0;
}
