#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<pair<int, int> > lr(1000001, make_pair(-1, -1));
  vector<int> k(1000001);
  int n, l = 0, r = 1000001, maxk = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    k[x]++;
    if (lr[x].first == -1) lr[x].first = i + 1;
    lr[x].second = i + 1;
  }
  for (int i = 0; i < 1000001; ++i)
    if (k[i] > maxk)
      l = lr[i].first, r = lr[i].second, maxk = k[i];
    else if (k[i] == maxk && lr[i].second - lr[i].first < r - l)
      l = lr[i].first, r = lr[i].second;
  cout << l << ' ' << r;
  return 0;
}
