#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 100;
int a[maxN], b[maxN * 10];
int st[maxN * 10], fi[maxN * 10];
int n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%i", &a[i]);
    ++b[a[i]];
    fi[a[i]] = i;
  }
  int res = 0;
  for (int i = 0; i <= 1000000; i++) res = max(res, b[i]);
  for (int i = n - 1; i >= 0; i--) st[a[i]] = i;
  int kq = 100000000, ll = 0, rr = 0;
  for (int i = 0; i < n; i++)
    if (res == b[a[i]] && kq > fi[a[i]] - st[a[i]]) {
      kq = fi[a[i]] - st[a[i]];
      ll = st[a[i]];
      rr = fi[a[i]];
    }
  cout << ll + 1 << " " << rr + 1;
}
