#include <bits/stdc++.h>
int n = 0, m = 0, a[100002], b[1000002], c[1000002];
int main() {
  while (scanf("%d", &n) != EOF) {
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    if (n == 0) continue;
    int max = 0;
    int p = 0, q = 0, k = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      b[a[i]]++;
      if (b[a[i]] == 1) c[a[i]] = i;
      if (b[a[i]] > max) {
        max = b[a[i]];
        k = a[i];
        q = i;
      }
      if (b[a[i]] == max) {
        if (i - c[a[i]] < q - c[a[q]]) {
          q = i;
          k = a[i];
        }
      }
    }
    for (int j = 0; j <= q; j++) {
      if (a[j] == k) {
        p = j;
        break;
      }
    }
    printf("%d %d\n", p + 1, q + 1);
  }
  return 0;
}
