#include <bits/stdc++.h>
using namespace std;
map<long long, long long> m, lo, hi;
int main() {
  long long total, val;
  cin >> total;
  long long save;
  long long max1 = -1;
  for (long long i = 1; i <= total; i++) {
    cin >> val;
    m[val]++;
    if (!lo[val]) lo[val] = i;
    hi[val] = i;
    if (m[val] > max1) {
      max1 = m[val];
      save = val;
    } else if (m[val] == max1) {
      if (hi[val] - lo[val] < hi[save] - lo[save]) {
        save = val;
      }
    }
  }
  cout << lo[save] << " " << hi[save] << endl;
}
