#include <bits/stdc++.h>
using namespace std;
int a[100005], c[1000005], L[1000005], R[1000005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (c[a[i]] == 0) L[a[i]] = i;
    R[a[i]] = i;
    c[a[i]]++;
  }
  int ma = -1, ans = 1;
  for (int i = 1; i <= 1000000; i++)
    if (c[i] > ma) {
      ans = i;
      ma = c[i];
    } else if (c[i] == ma) {
      if (R[i] - L[i] < R[ans] - L[ans]) ans = i;
    }
  printf("%d %d\n", L[ans], R[ans]);
}
