#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> counts(1000001, 0);
  vector<int> s(1000001, 0);
  vector<int> f(1000001, 0);
  int max_counts = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    if (counts[x] == 0) {
      s[x] = i;
    }
    f[x] = i;
    ++counts[x];
    if (counts[x] > max_counts) {
      max_counts = counts[x];
    }
  }
  int res = 1000001;
  int len = n;
  for (int i = 0; i < counts.size(); ++i) {
    if (counts[i] == max_counts && (f[i] - s[i]) < len) {
      res = i;
      len = f[i] - s[i];
    }
  }
  cout << s[res] + 1 << " " << f[res] + 1 << "\n";
  return 0;
}
