#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const double pi = acos(-1.0);
int n, a[100011], d[1000111], l[1000111], r[1000111];
int main() {
  cin >> n;
  int m = 0, k = -1;
  memset(l, -1, sizeof l);
  memset(r, -1, sizeof r);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    d[a[i]]++;
    if (d[a[i]] > m) {
      m = d[a[i]];
    }
  }
  for (int i = 0; i < n; ++i) {
    if (l[a[i]] == -1) l[a[i]] = i;
  }
  for (int i = n - 1; i >= 0; --i) {
    if (r[a[i]] == -1) r[a[i]] = i;
  }
  int ansl = 1, ansr = n, ans = n;
  for (int i = 0; i < n; ++i) {
    if (d[a[i]] == m) {
      if (r[a[i]] - l[a[i]] + 1 < ans) {
        ans = r[a[i]] - l[a[i]] + 1;
        ansl = l[a[i]] + 1;
        ansr = r[a[i]] + 1;
      }
    }
  }
  printf("%d %d", ansl, ansr);
  return 0;
}
