#include <bits/stdc++.h>
using namespace std;
long long int v[4005];
long long int d[4005];
long long int p[4005];
long long int arr[100005];
pair<pair<int, int>, int> hasher[1000006];
int main() {
  int n, maxi = -1, num, ansl, ansr;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    hasher[arr[i]].second++;
    if (hasher[arr[i]].second == 1) {
      hasher[arr[i]].first.first = i + 1;
    }
    hasher[arr[i]].first.second = i + 1;
    if (hasher[arr[i]].second > maxi ||
        (hasher[arr[i]].second == maxi &&
         (ansr - ansl + 1 >
          hasher[arr[i]].first.second - hasher[arr[i]].first.first + 1))) {
      maxi = hasher[arr[i]].second;
      ansl = hasher[arr[i]].first.first;
      ansr = hasher[arr[i]].first.second;
    }
  }
  cout << ansl << " " << ansr << endl;
}
