#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> v(n, 0);
  unordered_map<int, int> m;
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i]);
    if (m.find(v[i]) != m.end()) {
      m[v[i]]++;
    } else
      m[v[i]] = 1;
  }
  int mx = -1;
  unordered_set<int> nos;
  map<int, int> beg;
  unordered_map<int, int> c;
  map<int, int> e;
  for (unordered_map<int, int>::iterator i = m.begin(); i != m.end(); i++) {
    if (i->second > mx) {
      nos.clear();
      c.clear();
      mx = i->second;
      nos.insert(i->first);
      c[i->first] = 0;
    } else if (i->second == mx) {
      nos.insert(i->first);
      c[i->first] = 0;
    }
  }
  for (int i = 0; i < n; i++) {
    if (nos.find(v[i]) != nos.end()) {
      if (c[v[i]] == 0) beg[v[i]] = i + 1;
      c[v[i]]++;
      if (c[v[i]] == mx) e[v[i]] = i + 1;
    }
  }
  int mn = 10000000;
  int mnval;
  for (map<int, int>::iterator i = beg.begin(); i != beg.end(); i++) {
    if ((e[i->first] - i->second) < mn) {
      mn = (e[i->first] - i->second);
      mnval = i->first;
    }
  }
  printf("%d %d", beg[mnval], e[mnval]);
  return 0;
}
