#include <bits/stdc++.h>
using namespace std;
map<int, int> A;
int AA[1000000];
int n, M = 0, a, awal, akhir;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    A[a]++;
    if (A[a] == 1) AA[a] = i;
    if (A[a] == M) {
      if (akhir - awal > i - AA[a]) {
        awal = AA[a];
        akhir = i;
      }
    } else if (M < A[a]) {
      M = A[a];
      awal = AA[a];
      akhir = i;
    }
  }
  cout << awal << " " << akhir;
}
