#include <bits/stdc++.h>
using namespace std;
int mark[1000005], beauty;
vector<int> last[1000005];
int n;
int a[1000005], l, r;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    last[a[i]].push_back(i);
    mark[a[i]]++;
    beauty = max(beauty, mark[a[i]]);
  }
  int ans = INT_MAX;
  for (int i = 0; i <= 1000000; i++) {
    if (last[i].size() == beauty) {
      if (last[i][last[i].size() - 1] - last[i][0] < ans) {
        ans = last[i][last[i].size() - 1] - last[i][0];
        l = last[i][0];
        r = last[i][last[i].size() - 1];
      }
    }
  }
  cout << 1 + l << " " << 1 + r << endl;
  return 0;
}
