Problem: Amr has got a large array of size n. Amr doesn't like large arrays so he intends to make it smaller.

Amr doesn't care about anything in the array except the beauty of it. The beauty of the array is defined to be the maximum number of times that some number occurs in this array. He wants to choose the smallest subsegment of this array such that the beauty of it will be the same as the original array.

Help Amr by choosing the smallest subsegment possible.

Input

The first line contains one number n (1 ≤ n ≤ 105), the size of the array.

The second line contains n integers ai (1 ≤ ai ≤ 106), representing elements of the array.

Output

Output two integers l, r (1 ≤ l ≤ r ≤ n), the beginning and the end of the subsegment chosen respectively.

If there are several possible answers you may output any of them. 

Examples

Input

5
1 1 2 2 1


Output

1 5

Input

5
1 2 2 3 1


Output

2 3

Input

6
1 2 2 1 1 2


Output

1 5

Note

A subsegment B of an array A from l to r is an array of size r - l + 1 where Bi = Al + i - 1 for all 1 ≤ i ≤ r - l + 1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int inf = 0x7FFFFFFF;
struct point_int {
  int x, y;
  point_int() {}
  point_int(int a, int b) { x = a, y = b; }
};
struct point_double {
  double x, y;
  point_double() {}
  point_double(double a, double b) { x = a, y = b; }
};
struct Node {
  int v, w;
  Node() {}
  bool operator<(const Node &a) const { return w > a.w; }
  Node(int _v, int _w) { v = _v, w = _w; }
};
namespace my {
template <class T>
T gcd(T a, T b) {
  return b == 0 ? a : gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
T big_mod(T n, T p, T m) {
  if (p == 0) return (T)1;
  T x = big_mod(n, p / 2, m);
  x = (x * x) % m;
  if (p & 1) x = (x * n) % m;
  return x;
}
template <class T>
T multiplication(T n, T p, T m) {
  if (p == 0) return (T)0;
  T x = multiplication(n, p / 2, m);
  x = (x + x) % m;
  if (p & 1) x = (x + n) % m;
  return x;
}
template <class T>
T my_pow(T n, T p) {
  if (p == 0) return 1;
  T x = my_pow(n, p / 2);
  x = (x * x);
  if (p & 1) x = (x * n);
  return x;
}
template <class T>
double getdist(T a, T b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
template <class T>
T extract(string s, T ret) {
  stringstream ss(s);
  ss >> ret;
  return ret;
}
template <class T>
string tostring(T n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
template <class T>
inline T Mod(T n, T m) {
  return (n % m + m) % m;
}
template <class T>
T MIN3(T a, T b, T c) {
  return min(a, min(b, c));
}
template <class T>
T MAX3(T a, T b, T c) {
  return max(a, max(b, c));
}
template <class T>
void print_vector(T &v) {
  int sz = v.size();
  if (sz) cout << v[0];
  for (int i = 1; i < sz; i++) cout << ' ' << v[i];
  cout << endl;
}
bool isVowel(char ch) {
  ch = toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
bool isConsonant(char ch) {
  if (isalpha(ch) && !isVowel(ch)) return true;
  return false;
}
}  // namespace my
int read_int() {
  int n;
  scanf("%d", &n);
  return n;
}
int read_LLD() {
  long long int n;
  scanf("%lld", &n);
  return n;
}
inline int buffer_input() {
  char inp[1000];
  scanf("%s", inp);
  return atoi(inp);
}
int posS[1000005];
int posE[1000005];
map<int, int> M;
int main() {
  int N;
  cin >> N;
  fill(posS, posS + 1000005, inf);
  fill(posE, posE + 1000005, -inf);
  for (int i = 1; i <= N; i++) {
    int x;
    cin >> x;
    posS[x] = min(posS[x], i);
    posE[x] = max(posE[x], i);
    M[x]++;
  }
  int Max = -1;
  int val;
  int beauty;
  for (auto x : M) {
    if (x.second > Max) {
      val = x.first;
      Max = x.second;
      beauty = posE[val] - posS[val] + 1;
    } else if (x.second == Max) {
      if (beauty > (posE[x.first] - posS[x.first] + 1)) {
        beauty = posE[x.first] - posS[x.first] + 1;
        val = x.first;
      }
    }
  }
  cout << posS[val] << " " << posE[val] << endl;
  return 0;
}