#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
struct pi {
  int a, x;
} c[N];
bool cmp(pi a, pi b) {
  if (a.a != b.a) return a.a < b.a;
  return a.x < b.x;
}
int n, pre, num, ans;
int nl, nr, l, r;
void fun() {
  if (num < pre) {
    num = pre;
    l = nl;
    r = nr;
    ans = r - l + 1;
  } else if (num == pre) {
    int k = nr - nl + 1;
    if (k < ans) {
      ans = k;
      l = nl;
      r = nr;
    }
  }
}
int main() {
  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i < n; i++) {
      scanf("%d", &c[i].a);
      c[i].x = i + 1;
    }
    sort(c, c + n, cmp);
    pre = ans = num = 1;
    l = r = nl = nr = c[0].x;
    for (int i = 1; i < n; i++) {
      if (c[i].a == c[i - 1].a) {
        pre++;
        nr = c[i].x;
        continue;
      }
      fun();
      pre = 1;
      nl = nr = c[i].x;
    }
    fun();
    printf("%d %d\n", l, r);
  }
  return 0;
}
