#include <bits/stdc++.h>
using namespace std;
int a[1000010];
int ll[1000010];
int rr[1000010];
int main() {
  int n;
  cin >> n;
  int max = 0;
  for (int i = 0; i < n; ++i) {
    int q;
    cin >> q;
    if (a[q] == 0) ll[q] = i;
    rr[q] = i;
    ++a[q];
    if (a[q] > a[max]) {
      max = q;
    }
  }
  int l = 0, r = n - 1;
  for (int i = 0; i <= 1000000; ++i) {
    if (a[i] == a[max]) {
      if (rr[i] - ll[i] < r - l) {
        l = ll[i];
        r = rr[i];
      }
    }
  }
  cout << l + 1 << " " << r + 1 << "\n";
  return 0;
}
