#include <bits/stdc++.h>
using namespace std;
vector<int> v[1000005];
int n, ar[100005];
int main() {
  cin >> n;
  set<int> st;
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
    st.insert(ar[i]);
    v[ar[i]].push_back(i + 1);
  }
  vector<int> fr(st.begin(), st.end());
  int mx = 0, l = 1, r = n, mnd = INT_MAX;
  for (int i = 0; i < fr.size(); i++) {
    int x = fr[i];
    if (v[fr[i]].size() >= mx) {
      if (mx < v[fr[i]].size() || v[x][v[x].size() - 1] - v[x][0] < mnd) {
        l = v[x][0];
        r = v[x][v[x].size() - 1];
        mnd = v[x][v[x].size() - 1] - v[x][0];
        mx = v[x].size();
      }
    }
  }
  cout << l << " " << r << endl;
  return 0;
}
