#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-6;
const int INF = (int)(INT_MAX - 100);
const long long mod = (int)(1e+9 + 7);
const int N = (int)(1e6);
int main() {
  int n;
  cin >> n;
  vector<int> v(n), k(N + 1), d(N + 1);
  vector<pair<int, int> > e(N + 1, {n, 1});
  for (int i = 0; i < n; i++) scanf("%d", &v[i]);
  for (int i = 0; i < n; i++) {
    k[v[i]]++;
    e[v[i]].first = min(e[v[i]].first, i + 1);
    e[v[i]].second = max(e[v[i]].first, i + 1);
  }
  int M = *max_element(k.begin(), k.end()), m = INF;
  pair<int, int> ans;
  for (int num = (1); num <= (N); num++) d[num] = e[num].second - e[num].first;
  for (int num = (1); num <= (N); num++) {
    if (k[num] != M) continue;
    if (m <= d[num]) continue;
    m = d[num];
    ans = e[num];
  }
  cout << ans.first << " " << ans.second;
  return 0;
}
