#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, int> a, b, c;
  map<int, int>::iterator it;
  int n, i, x, m, k, l, r;
  cin >> n;
  m = 1;
  for (i = 1; i <= n; i++) {
    cin >> x;
    a[x]++;
    m = max(m, a[x]);
    if (a[x] == 1) b[x] = i;
    c[x] = i;
  }
  k = n;
  l = 1;
  r = n;
  for (it = a.begin(); it != a.end(); it++) {
    if (it->second == m) {
      x = it->first;
      if (c[x] - b[x] + 1 < k) {
        k = c[x] - b[x] + 1;
        l = b[x];
        r = c[x];
      }
    }
  }
  cout << l << " " << r << endl;
  return 0;
}
