#include <bits/stdc++.h>
using namespace std;
long long int li[1000005], A[100011], ri[1000005], c[1000005];
int main() {
  long long int n, i, loci, locj;
  cin >> n;
  long long int maxi = INT_MIN;
  for (i = 0; i < n; i++) {
    cin >> A[i];
    if (!c[A[i]]) {
      c[A[i]]++;
      li[A[i]] = i + 1;
      ri[A[i]] = i + 1;
    } else {
      c[A[i]]++;
      ri[A[i]] = i + 1;
    }
    if (maxi < c[A[i]]) {
      maxi = c[A[i]];
    }
  }
  long long int ans = INT_MAX;
  for (i = 0; i < 1000005; i++) {
    if (c[i] == maxi) {
      if (ans > (ri[i] - li[i])) {
        ans = (ri[i] - li[i]);
        loci = li[i];
        locj = ri[i];
      }
    }
  }
  cout << loci << " " << locj << endl;
  return 0;
}
