#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int l[N], r[N], cnt[N];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 0; i < N; ++i) {
    l[i] = 1e9;
    r[i] = -1e9;
  }
  int n;
  std::cin >> n;
  int mx = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    std::cin >> x;
    cnt[x]++;
    mx = std::max(mx, cnt[x]);
    l[x] = std::min(l[x], i);
    r[x] = std::max(r[x], i);
  }
  int answ = 1e9, l1 = 0, r1 = 0;
  for (int i = 0; i < N; ++i) {
    if (cnt[i] == mx) {
      if (r[i] - l[i] + 1 < answ) {
        answ = r[i] - l[i] + 1;
        l1 = l[i];
        r1 = r[i];
      }
    }
  }
  std::cout << l1 + 1 << ' ' << r1 + 1 << '\n';
  return 0;
}
