#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int x;
  cin >> n;
  int maxocc = 0;
  int dis = numeric_limits<int>::max();
  unordered_map<int, int> occ;
  unordered_map<int, int> start;
  int candl = 1;
  int candr = 1;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (occ.count(x) == 0) {
      occ[x] = 1;
      start[x] = i;
    } else {
      occ[x]++;
    }
    if (occ[x] > maxocc) {
      candl = start[x] + 1;
      candr = i + 1;
      maxocc = occ[x];
      dis = i - start[x] + 1;
    } else if (occ[x] == maxocc && (i - start[x] + 1) < dis) {
      candl = start[x] + 1;
      candr = i + 1;
      maxocc = occ[x];
      dis = i - start[x] + 1;
    }
  }
  cout << candl << " " << candr << endl;
  return 0;
}
