#include <bits/stdc++.h>
using namespace std;
vector<long long> pos[1000 * 1000 + 2];
int32_t main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    pos[x].push_back(i);
  }
  long long mx = 0;
  for (long long i = 1; i <= 1000 * 1000; i++)
    mx = max(mx, (long long)pos[i].size());
  long long mn = n, l = 1, r = n;
  for (long long i = 1; i <= 1000 * 1000; i++) {
    if (pos[i].size() == mx) {
      if (pos[i][pos[i].size() - 1] - pos[i][0] + 1 < mn) {
        mn = pos[i][pos[i].size() - 1] - pos[i][0] + 1;
        l = pos[i][0] + 1, r = pos[i][pos[i].size() - 1] + 1;
      }
    }
  }
  cout << l << " " << r << endl;
  return 0;
}
