#include <bits/stdc++.h>
using namespace std;
template <typename T, typename T1>
ostream& operator<<(ostream& out, pair<T, T1> obj) {
  return out << "(" << obj.first << "," << obj.second << ")";
}
template <typename T, typename T1>
ostream& operator<<(ostream& out, map<T, T1> cont) {
  typename map<T, T1>::const_iterator itr = cont.begin();
  typename map<T, T1>::const_iterator ends = cont.end();
  for (; itr != ends; ++itr) out << *itr << " ";
  out << endl;
}
template <typename T,
          template <typename ELEM, typename ALLOC = allocator<ELEM>> class CONT>
ostream& operator<<(ostream& out, CONT<T> cont) {
  typename CONT<T>::const_iterator itr = cont.begin();
  typename CONT<T>::const_iterator ends = cont.end();
  for (; itr != ends; ++itr) out << *itr << " ";
  out << endl;
}
template <typename T>
T gcd(T a, T b) {
  T min_v = min(a, b);
  T max_v = max(a, b);
  while (min_v) {
    T temp = max_v % min_v;
    max_v = min_v;
    min_v = temp;
  }
  return max_v;
}
int N, maxTime, min_length = -1, startPos, endPos;
int elements[100010], counts[1000010], start_pos[1000010];
vector<pair<int, int>> keep;
int main() {
  scanf("%d", &N);
  for (auto i = 0 - (0 > N); i != N - (0 > N); i += 1 - 2 * (0 > N))
    scanf("%d", elements + i);
  for (auto i = 0 - (0 > 1000010); i != 1000010 - (0 > 1000010);
       i += 1 - 2 * (0 > 1000010))
    start_pos[i] = -1;
  for (auto i = 0 - (0 > N); i != N - (0 > N); i += 1 - 2 * (0 > N))
    if (start_pos[elements[i]] == -1) start_pos[elements[i]] = i + 1;
  for (auto i = 0 - (0 > N); i != N - (0 > N); i += 1 - 2 * (0 > N)) {
    ++counts[elements[i]];
    if (counts[elements[i]] > maxTime) maxTime = counts[elements[i]];
  }
  for (auto i = 0 - (0 > 1000010); i != 1000010 - (0 > 1000010);
       i += 1 - 2 * (0 > 1000010))
    counts[i] = 0;
  for (auto i = 0 - (0 > N); i != N - (0 > N); i += 1 - 2 * (0 > N)) {
    ++counts[elements[i]];
    if (counts[elements[i]] == maxTime) keep.emplace_back(i + 1, elements[i]);
  }
  if (keep.size()) {
    for (auto i = 0 - (0 > keep.size()); i != keep.size() - (0 > keep.size());
         i += 1 - 2 * (0 > keep.size())) {
      int len = keep[i].first - start_pos[keep[i].second];
      if (min_length == -1 || len < min_length) {
        min_length = len;
        startPos = start_pos[keep[i].second];
        endPos = keep[i].first;
      }
    }
    printf("%d %d\n", startPos, endPos);
  } else
    printf("%d %d\n", 1, N);
  return 0;
}
