#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
set<int> st;
set<int>::iterator it;
int main() {
  int x, mx = 0;
  cin >> x;
  int y[x];
  vector<vector<int> > buff(999999);
  for (int i = 0; i < x; i++) {
    cin >> y[i];
    mp[y[i]]++;
    if (mp[y[i]] > mx) {
      mx = mp[y[i]];
    }
  }
  for (int i = 0; i < x; i++) {
    if (mp[y[i]] == mx) {
      buff[y[i]].push_back(i);
      st.insert(y[i]);
    }
  }
  int a = 0, b = 0, mn = 9999999999, c = 0, d = 0;
  for (it = st.begin(); it != st.end(); it++) {
    a = buff[*it][0] + 1;
    b = buff[*it][buff[*it].size() - 1] + 1;
    if (b - a < mn) {
      mn = b - a;
      c = a;
      d = b;
    }
  }
  cout << c << " " << d;
}
