#include <bits/stdc++.h>
using namespace std;
int main() {
  int mxc = 0;
  map<int, int> m;
  map<int, int>::iterator it;
  map<int, pair<int, int> > p;
  int n;
  cin >> n;
  int nn;
  int minInd = 1000009;
  int mnc = 1000009;
  for (int i = 1; i <= n; i++) {
    cin >> nn;
    it = m.find(nn);
    if (it != m.end()) {
      it->second = it->second + 1;
      p[nn].second = i;
      int newd = p[nn].second - p[nn].first;
      if (mxc == it->second && mnc > newd) {
        mnc = newd;
        minInd = nn;
      } else if (mxc < it->second) {
        mxc = it->second;
        mnc = newd;
        minInd = nn;
      }
    } else {
      m[nn] = 1;
      if (mxc < 1) {
        mxc = 1;
        mnc = 0;
        minInd = nn;
      }
      p[nn] = pair<int, int>(i, i);
    }
  }
  cout << p[minInd].first << " " << p[minInd].second << "\n";
}
