#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  map<int, int> m;
  pair<int, int> maxx;
  pair<int, int> idx;
  map<int, int> fo;
  idx.first = 0;
  idx.second = INT_MAX;
  maxx.second = -456;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (!m.count(arr[i])) {
      fo[arr[i]] = i;
      m[arr[i]] = 1;
    } else
      m[arr[i]]++;
    if (m[arr[i]] >= maxx.second) {
      if (i - fo[arr[i]] < (idx.second - idx.first) ||
          (m[arr[i]]) > maxx.second) {
        maxx.first = arr[i];
        maxx.second = m[arr[i]];
        idx.first = fo[arr[i]];
        idx.second = i;
      }
    }
  }
  cout << idx.first + 1 << " " << idx.second + 1;
  return 0;
}
