#include <bits/stdc++.h>
using namespace std;
template <class T>
using v2d = vector<vector<T> >;
template <class T>
bool uin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
const int maxN = 1e5 + 10;
int n, a[maxN], ans_l, ans_r, len;
map<int, int> mp, lb, rb;
void solve() {
  cin >> n;
  for (int i = 1; i <= (int)(n); ++i) {
    cin >> a[i];
  }
  for (int i = 1; i <= (int)(n); ++i) {
    mp[a[i]]++;
  }
  int mx = 0;
  for (auto &p : mp) {
    uax(mx, p.second);
  }
  for (int i = 1; i <= (int)(n); ++i) {
    rb[a[i]] = i;
  }
  for (int i = n; i; i--) {
    lb[a[i]] = i;
  }
  len = n + 1;
  for (auto &p : mp) {
    if (p.second == mx) {
      if (uin(len, rb[p.first] - lb[p.first] + 1)) {
        ans_l = lb[p.first];
        ans_r = rb[p.first];
      }
    }
  }
  cout << ans_l << " " << ans_r;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
