#include <bits/stdc++.h>
using namespace std;
long long F[1000007], L[1000007];
long long C[1000007];
int main() {
  for (long long i = (0); i < (1000007); i++) {
    F[i] = -1;
    L[i] = -1;
  }
  memset(C, 0, sizeof(C));
  long long n;
  scanf("%lld", &n);
  for (long long i = (0); i < (n); i++) {
    long long v;
    scanf("%lld", &v);
    if (F[v] == -1) {
      F[v] = i;
    }
    L[v] = i;
    C[v]++;
  }
  long long mx = 0;
  long long aL, aR;
  for (long long i = (0); i < (1000007); i++) {
    if (C[i] > mx) {
      aL = F[i];
      aR = L[i];
      mx = C[i];
    } else if (C[i] == mx) {
      if (L[i] - F[i] < aR - aL) {
        aL = F[i];
        aR = L[i];
      }
    }
  }
  printf("%lld ", aL + 1);
  printf("%lld\n", aR + 1);
}
