#include <bits/stdc++.h>
using namespace std;
pair<int, pair<int, int> > a[1000001];
int main() {
  int n, ans = 0, i, x, l, r;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> x;
    if (!a[x].first)
      a[x].first++, a[x].second.first = i, a[x].second.second = i;
    else
      a[x].first++, a[x].second.second = i;
  }
  sort(a + 1, a + 1000001);
  l = a[1000000].second.first;
  r = a[1000000].second.second;
  for (i = 1000000; i >= 2; i--) {
    if (a[i].first != a[i - 1].first)
      break;
    else {
      if ((r - l) > (a[i - 1].second.second - a[i - 1].second.first))
        r = a[i - 1].second.second, l = a[i - 1].second.first;
    }
  }
  cout << l << " " << r;
}
