#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    map<int, pair<int, int> > memo;
    int top_len = 1000000, top_cnt = 0, top_num = -1;
    for (int i = 1; i <= n; ++i) {
      int a;
      cin >> a;
      map<int, pair<int, int> >::iterator itr;
      if ((itr = memo.find(a)) != memo.end()) {
        itr->second.second++;
      } else {
        pair<map<int, pair<int, int> >::iterator, bool> t;
        t = memo.insert(make_pair(a, make_pair(i, 1)));
        itr = t.first;
      }
      if (itr->second.second > top_cnt ||
          (itr->second.second == top_cnt && i - itr->second.first < top_len)) {
        top_len = i - itr->second.first;
        top_cnt = itr->second.second;
        top_num = a;
      }
    }
    int ans = memo.find(top_num)->second.first;
    cout << ans << " " << ans + top_len << endl;
  }
  return 0;
}
