#include <bits/stdc++.h>
using namespace std;
const int N = 123456;
const double eps = 1e-11;
const int inf = (int)2e9;
const int mod = (int)1e9 + 7;
map<int, int> freq;
map<int, int> first;
map<int, int> last;
int a[N];
int main() {
  int n, mx = -1;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    freq[a[i]]++;
    mx = max(mx, freq[a[i]]);
    if (first[a[i]] == 0) {
      first[a[i]] = i;
    }
    last[a[i]] = i;
  }
  int ans = inf;
  int num = inf;
  for (int i = 1; i <= n; i++) {
    if (freq[a[i]] == mx) {
      if (ans > last[a[i]] - first[a[i]] + 1) {
        ans = last[a[i]] - first[a[i]] + 1;
        num = a[i];
      }
    }
  }
  printf("%d %d\n", first[num], last[num]);
  return 0;
}
