#include <bits/stdc++.h>
using namespace std;
int e[1000000 + 10], s[1000000 + 10], t[1000000 + 10], a[1000000 + 10];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    t[a[i]]++;
    if (s[a[i]] == 0) s[a[i]] = i;
    e[a[i]] = i;
  }
  int mx = 0, l = 0, r = 0;
  for (int i = 1; i <= 1000000; i++) {
    if ((t[i] > mx) || (t[i] == mx && e[i] - s[i] < r - l))
      mx = t[i], l = s[i], r = e[i];
  }
  cout << l << ' ' << r;
}
