#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int res = 0;
  char c;
  while ((c = getchar()) < '0' || c > '9')
    ;
  while (c >= '0' && c <= '9') res = res * 10 + c - '0', c = getchar();
  return res;
}
int m[1000010];
int l[1000010];
int main() {
  int n = in();
  int x, ans1, ans2;
  int mx = 0;
  int mn = 0x3f3f3f3f;
  for (int i = 0; i < n; i++) {
    x = in();
    if (m[x] == 0) {
      m[x] = 1;
      l[x] = i;
    } else
      m[x]++;
    if (m[x] > mx) {
      mx = m[x];
      ans1 = l[x];
      ans2 = i;
      mn = ans2 - ans1;
    } else if (m[x] == mx && i - l[x] < mn) {
      ans1 = l[x];
      ans2 = i;
      mn = ans2 - ans1;
    }
  }
  cout << ans1 + 1 << " " << ans2 + 1;
  return 0;
}
