#include <bits/stdc++.h>
int freq[1000005], l[1000005], r[1000005];
int main() {
  int n, x;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    if (freq[x]++ == 0) {
      l[x] = i;
    }
    r[x] = i;
  }
  int a = -1, b, c;
  for (int i = 0; i < 1000005; i++) {
    if (freq[i] > a) {
      a = freq[i];
      b = l[i];
      c = r[i];
    } else if (freq[i] == a && r[i] - l[i] < c - b) {
      b = l[i];
      c = r[i];
    }
  }
  printf("%d %d\n", b, c);
  return 0;
}
