#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, z = 0, d = 1e7, p, k;
  map<long long int, long long int> m;
  cin >> n;
  long long int a[n + 1];
  vector<pair<long long int, long long int> > v;
  v.push_back(make_pair(0, 0));
  for (i = 1; i <= 1000000; i++) v.push_back(make_pair(0, 0));
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    m[a[i]]++;
  }
  for (i = 1; i <= n; i++) {
    if (v[a[i]].first == 0) {
      v[a[i]].first = i;
    }
  }
  for (i = n; i >= 1; i--) {
    if (v[a[i]].second == 0) {
      v[a[i]].second = i;
    }
  }
  map<long long int, long long int>::iterator it;
  for (it = m.begin(); it != m.end(); it++) {
    z = max(z, it->second);
  }
  for (it = m.begin(); it != m.end(); it++) {
    if (z == it->second) {
      if (d > v[it->first].second - v[it->first].first) {
        d = v[it->first].second - v[it->first].first;
        p = v[it->first].first;
        k = v[it->first].second;
      }
    }
  }
  cout << p << " " << k << '\n';
}
