#include <bits/stdc++.h>
using namespace std;
struct arr {
  int s, e;
  long long int ti = 0;
} ar;
map<int, arr> v;
queue<int> q;
int main() {
  int n;
  while (cin >> n) {
    int mt = -1;
    for (int i = 1; i <= n; i++) {
      int r;
      cin >> r;
      if (v[r].ti == 0) v[r].s = i;
      v[r].ti++;
      v[r].e = i;
      if (v[r].ti > mt) {
        mt = v[r].ti;
        while (!q.empty()) q.pop();
        q.push(r);
      } else if (v[r].ti == mt) {
        q.push(r);
      }
    }
    int w = 1000000;
    int a = 1, b = 1;
    while (!q.empty()) {
      int t = q.front();
      q.pop();
      if (v[t].e - v[t].s < w) {
        w = v[t].e - v[t].s;
        a = v[t].s;
        b = v[t].e;
      }
    }
    cout << a << ' ' << b << endl;
    v.clear();
  }
  return 0;
}
