#include <bits/stdc++.h>
int main() {
  int numbers;
  while (scanf("%d", &numbers) == 1) {
    int data[numbers + 1];
    int *first_occur = (int *)calloc(1000001, sizeof(int));
    int *last_occur = (int *)calloc(1000001, sizeof(int));
    int *count = (int *)calloc(1000001, sizeof(int));
    int max = 0;
    for (int i = 1; i <= numbers; i++) {
      scanf("%d", &data[i]);
      count[data[i]]++;
      if (first_occur[data[i]] == 0) {
        first_occur[data[i]] = i;
      }
      last_occur[data[i]] = i;
      if (max < count[data[i]]) {
        max = count[data[i]];
      }
    }
    int min_dist = 10000000, min_num = 0;
    for (int i = 1; i <= 1000000; i++) {
      if (count[i] == max) {
        if (min_dist > (last_occur[i] - first_occur[i])) {
          min_dist = (last_occur[i] - first_occur[i] + 1);
          min_num = i;
        }
      }
    }
    printf("%d %d\n", first_occur[min_num], last_occur[min_num]);
  }
  return 0;
}
