#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
const long long mod = (1e9) + 7;
int n;
int cnt[N], a[N];
vector<int> vec[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cerr.tie(nullptr);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    vec[x].push_back(i);
    cnt[x]++;
    a[i] = x;
  }
  int mx = 0;
  for (int i = 1; i <= n; i++) {
    int x = a[i];
    mx = max(mx, cnt[x]);
  }
  int l = 1, r = n;
  for (int i = 1; i <= n; i++) {
    int x = a[i];
    if (vec[x].size() == mx) {
      int l1 = vec[x][0], r1 = vec[x].back();
      if (r - l > r1 - l1) {
        l = l1;
        r = r1;
      }
    }
  }
  cout << l << " " << r;
}
