#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int mx = -1;
  map<int, vector<int>> pos;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    pos[x].push_back(i);
    mx = max(mx, (int)pos[x].size());
  }
  int mn = n + 1;
  int wr = -1;
  for (auto [x, p] : pos) {
    assert(!p.empty());
    if ((int)p.size() == mx && p.back() - p.front() < mn) {
      mn = p.back() - p.front();
      wr = x;
    }
  }
  cout << pos[wr].front() + 1 << ' ' << pos[wr].back() + 1 << endl;
}
