#include <bits/stdc++.h>
using namespace std;
int arr[1000005], s[1000005], e[10000005];
int main() {
  int i, j, n;
  memset(arr, 0, sizeof(arr));
  memset(s, -1, sizeof(s));
  memset(e, -1, sizeof(e));
  cin >> n;
  int max = -1, maxi, l = INT_MAX;
  for (i = 1; i < n + 1; i++) {
    cin >> j;
    arr[j]++;
    if (s[j] == -1) {
      s[j] = i;
      e[j] = i;
    } else
      e[j] = i;
    if (arr[j] > max) {
      max = arr[j];
      maxi = j;
      l = e[j] - s[j];
    } else if (arr[j] == max) {
      if ((e[j] - s[j]) < l) {
        l = e[j] - s[j];
        maxi = j;
      }
    }
  }
  cout << s[maxi] << " " << e[maxi];
  return 0;
}
