#include <bits/stdc++.h>
using namespace std;
long long a[100004], cnt[1000004];
pair<long long, long long> p[1000002];
int main() {
  long long n, k = INT_MIN, temp = INT_MIN, x, y;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    k = max(k, a[i]);
  }
  for (int i = 1; i <= k; i++) p[i] = make_pair(INT_MAX, INT_MIN);
  for (long long i = 0; i < n; i++) {
    cnt[a[i]]++;
    p[a[i]].first = min(p[a[i]].first, i);
    p[a[i]].second = max(p[a[i]].second, i);
  }
  for (int i = 1; i <= k; i++) {
    if (temp == cnt[i] && (y - x) > p[i].second - p[i].first) {
      x = p[i].first;
      y = p[i].second;
      temp = cnt[i];
    } else if (temp < cnt[i]) {
      x = p[i].first;
      y = p[i].second;
      temp = cnt[i];
    }
  }
  cout << x + 1 << ' ' << y + 1 << "\n";
}
