#include <bits/stdc++.h>
using namespace std;
map<long int, long int> freq;
long int lower[1000006];
long int upper[1000006];
int main() {
  int N;
  long int n;
  scanf("%d", &N);
  memset(lower, -1, sizeof(lower));
  memset(upper, -1, sizeof(upper));
  for (int i = 0; i < N; ++i) {
    scanf("%ld", &n);
    freq[n]++;
    if (lower[n] == -1) {
      lower[n] = i;
    }
    if (i > upper[n]) upper[n] = i;
  }
  int maxi = INT_MIN;
  int num;
  for (auto it = freq.begin(); it != freq.end(); ++it) {
    if (maxi < it->second) {
      num = it->first;
      maxi = it->second;
    }
  }
  int i, j;
  i = 0;
  j = N - 1;
  for (auto it = freq.begin(); it != freq.end(); ++it) {
    if (it->second == maxi) {
      int diff = upper[it->first] - lower[it->first];
      if (diff < (j - i)) {
        i = lower[it->first];
        j = upper[it->first];
      }
    }
  }
  printf("%d %d\n", i + 1, j + 1);
}
