#include <bits/stdc++.h>
using namespace std;
int MaxOcc;
const int inf = 1 << 30;
int AnswerProblem = inf;
int AnswerLeft, AnswerRight;
int cnt[1048576];
int helloworld1[1048576], helloworld2[1048576];
int main() {
  int n, i;
  cin >> n;
  for (i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (!cnt[a]) helloworld1[a] = i;
    cnt[a]++;
    MaxOcc = max(MaxOcc, cnt[a]);
    helloworld2[a] = i;
  }
  for (i = 0; i <= 1000000; i++)
    if (cnt[i] == MaxOcc) {
      if (helloworld2[i] - helloworld1[i] + 1 < AnswerProblem) {
        AnswerProblem = helloworld2[i] - helloworld1[i] + 1;
        AnswerLeft = helloworld1[i];
        AnswerRight = helloworld2[i];
      }
    }
  AnswerLeft++;
  AnswerRight++;
  cout << AnswerLeft << " " << AnswerRight << endl;
  return 0;
}
