#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int maxi = 0;
  long mini = n;
  vector<int> beaty_elem(1000005, 0);
  vector<int> distance(1000005, 0);
  int x;
  int ch = 1;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (beaty_elem[x] == 0) {
      beaty_elem[x] = 1;
      distance[x] = i;
    } else {
      beaty_elem[x]++;
    }
    if (beaty_elem[x] > maxi) {
      maxi = beaty_elem[x];
      mini = i - distance[x] + 1;
      ch = i;
    }
    if ((beaty_elem[x] == maxi) && (abs(i + 1 - distance[x]) < mini)) {
      mini = i - distance[x] + 1;
      ch = i;
    }
  }
  cout << ch - mini + 1 << "\t" << ch;
  return 0;
}
