#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  int n, a;
  cin >> n;
  map<int, pair<int, pair<int, int>>> x;
  int c[100001];
  for (int i = 0; i < n; i++) {
    cin >> a;
    c[i] = a;
    x[a].second.first = 10000000;
  }
  for (int i = 0; i < n; i++) {
    x[c[i]].first++;
    x[c[i]].second.first = min(x[c[i]].second.first, i);
    x[c[i]].second.second = max(x[c[i]].second.second, i);
  }
  std::map<int, pair<int, pair<int, int>>>::iterator it;
  pair<int, pair<int, int>> ans;
  for (it = x.begin(); it != x.end(); ++it) {
    pair<int, pair<int, int>> t = it->second;
    if (t.first > ans.first) {
      ans = t;
    } else if (t.first == ans.first) {
      if (abs(ans.second.first - ans.second.second) >
          abs(t.second.first - t.second.second))
        ans = t;
    }
  }
  cout << ans.second.first + 1 << " " << ans.second.second + 1 << endl;
  return 0;
}
