#include <bits/stdc++.h>
using namespace std;
struct item {
  int f;
  int s;
  int c;
};
item ab[1000005];
int main() {
  ios_base::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(10);
  cout.tie(nullptr);
  cin.tie(nullptr);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int item;
    cin >> item;
    if (ab[item].f == 0) {
      ab[item].f = i;
      ab[item].s = i;
    } else {
      ab[item].s = i;
    }
    ab[item].c++;
  }
  vector<item> items;
  for (int i = 0; i < 1000005; i++) {
    if (ab[i].c > 0) items.push_back(ab[i]);
  }
  sort(items.begin(), items.end(), [](item &l, item &r) {
    if (l.c > r.c) {
      return true;
    }
    if (l.c == r.c) {
      return l.s - l.f < r.s - r.f;
    }
    return false;
  });
  cout << items[0].f << " " << items[0].s << endl;
  int pause;
  cin >> pause;
  return 0;
}
