#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, max = 0, len, s;
  cin >> n;
  map<int, int> m;
  map<int, int> l;
  for (int i = 0; i < n; ++i) {
    int temp;
    cin >> temp;
    if (m[temp])
      m[temp]++;
    else {
      m[temp]++;
      l[temp] = i;
    }
    if (m[temp] > max) {
      max = m[temp];
      len = i - l[temp] + 1;
      s = l[temp] + 1;
    } else if (m[temp] == max && i - l[temp] + 1 < len) {
      len = i - l[temp] + 1;
      s = l[temp] + 1;
    }
  }
  cout << s << ' ' << s + len - 1 << endl;
}
