#include <bits/stdc++.h>
using namespace std;
map<int, pair<int, pair<int, int> > > m;
int main() {
  int n;
  scanf("%d", &n);
  int maxx = -1;
  for (int i = 0; i < n; i++) {
    int x = 0;
    scanf("%d", &x);
    if (m[x].first == 0) {
      m[x].first = 1;
      m[x].second.first = i + 1;
      m[x].second.second = i + 1;
    } else {
      m[x].first++;
      m[x].second.second = i + 1;
    }
    maxx = max(maxx, m[x].first);
  }
  int res = 1 << 30;
  int i = 0;
  int j = 0;
  for (auto it : m) {
    if (it.second.first == maxx) {
      int ii = it.second.second.first;
      int jj = it.second.second.second;
      if (jj - ii < res) {
        res = jj - ii;
        i = ii;
        j = jj;
      }
    }
  }
  cout << i << " " << j << endl;
}
