#include <bits/stdc++.h>
using namespace std;
int freq[1000010];
int A[1000010];
bool marked[1000010];
vector<pair<int, int> > v(1000010);
int main() {
  int n;
  cin >> n;
  int maxa = 0;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    freq[A[i]]++;
    maxa = max(maxa, freq[A[i]]);
  }
  for (int i = 0; i < 1000010; i++) {
    v[i].first = v[i].second = INT_MAX;
  }
  for (int i = 0; i < n; i++) {
    if (freq[A[i]] == maxa && marked[A[i]] == 0) {
      v[A[i]].second = i + 1;
      marked[A[i]] = 1;
    } else if (freq[A[i]] == maxa && marked[A[i]] == 1) {
      v[A[i]].first = i + 1 - v[A[i]].second;
    }
  }
  if (maxa == 1) {
    cout << "1 1" << endl;
    return 0;
  }
  sort(v.begin(), v.end());
  cout << v[0].second << " " << v[0].first + v[0].second << endl;
  return 0;
}
