#include <bits/stdc++.h>
using namespace std;
int a, b[1000005] = {0};
pair<int, int> range[1000005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    b[a]++;
    range[a].second = i + 1;
    if (b[a] == 1) {
      range[a].first = i + 1;
    }
  }
  int max = -1;
  for (int i = 1; i <= 1000000; i++) {
    if (max < b[i]) max = b[i];
  }
  vector<int> dig;
  for (int i = 1; i <= 1000000; i++) {
    if (max == b[i]) dig.push_back(i);
  }
  int l = -1, r = -1;
  for (int i = 0; i < dig.size(); i++) {
    if (l == -1 && r == -1) {
      l = range[dig[i]].first;
      r = range[dig[i]].second;
    } else {
      int L = range[dig[i]].first, R = range[dig[i]].second;
      if (R - L < r - l) {
        l = L;
        r = R;
      }
    }
  }
  printf("%d %d\n", l, r);
  return 0;
}
