#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, int> p;
  map<int, pair<int, int>> c;
  int n, m, i, ans = 0;
  map<int, int>::iterator it;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> m;
    if (p[m] == 0) {
      c[m].first = i + 1;
      c[m].second = i + 1;
    } else
      c[m].second = i + 1;
    p[m]++;
  }
  int a, b;
  m = -1;
  for (it = p.begin(); it != p.end(); it++) {
    if (it->second > m) {
      a = c[it->first].first;
      b = c[it->first].second;
      m = it->second;
    } else if (it->second == m &&
               c[it->first].second - c[it->first].first < b - a) {
      a = c[it->first].first;
      b = c[it->first].second;
    }
  }
  cout << a << " " << b;
  return 0;
}
