#include <bits/stdc++.h>
using namespace std;
const int Nmax = 1e6 + 17;
int a[Nmax][3] = {0};
int main(void) {
  int n, x;
  scanf("%d", &n);
  for (int i = 0; i < Nmax; i++) a[i][0] = -1;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    if (a[x][0] == -1) a[x][0] = i;
    a[x][1] = i;
    a[x][2]++;
  }
  int l = 0, r = 0, count = 0;
  for (int i = 0; i < Nmax; i++) {
    if (a[i][2] > count) {
      l = a[i][0];
      r = a[i][1];
      count = a[i][2];
    }
    if (a[i][2] == count && r - l > a[i][1] - a[i][0]) {
      l = a[i][0];
      r = a[i][1];
    }
  }
  printf("%d %d", l + 1, r + 1);
}
