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
#include <bits/stdc++.h>
using namespace std;
class UnionFind {
 private:
  vector<int> p, rank;

 public:
  UnionFind(int N) {
    rank.assign(N, 0);
    p.assign(N, 0);
    for (int i = 0; i < N; i++) {
      p[i] = i;
    }
  }
  int findSet(int i) { return (p[i] == i) ? i : (p[i] = findSet(p[i])); }
  bool isSameSet(int i, int j) { return findSet(i) == findSet(j); }
  void unionSet(int i, int j) {
    if (!isSameSet(i, j)) {
      int x = findSet(i), y = findSet(j);
      if (rank[x] > rank[y])
        p[y] = x;
      else {
        p[x] = y;
        if (rank[x] == rank[y]) rank[y]++;
      }
    }
  }
};
class SegmentTree {
 private:
  vector<int> st, A;
  int n;
  int left(int p) { return p << 1; }
  int right(int p) { return (p << 1) + 1; }
  void build(int p, int L, int R) {
    if (L == R)
      st[p] = L;
    else {
      build(left(p), L, (L + R) / 2);
      build(right(p), (L + R) / 2 + 1, R);
      int p1 = st[left(p)], p2 = st[right(p)];
      st[p] = (A[p1] <= A[p2]) ? p1 : p2;
    }
  }
  int rmq(int p, int L, int R, int i, int j) {
    if (i > R || j < L) return -1;
    if (L >= i && R <= j) return st[p];
    int p1 = rmq(left(p), L, (L + R) / 2, i, j);
    int p2 = rmq(right(p), (L + R) / 2 + 1, R, i, j);
    if (p1 == -1) return p2;
    if (p2 == -1) return p1;
    return (A[p1] <= A[p2]) ? p1 : p2;
  }
  int update_point(int p, int L, int R, int idx, int new_value) {
    int i = idx, j = idx;
    if (i > R || j < L) return st[p];
    if (L == i && R == j) {
      A[i] = new_value;
      return st[p] = L;
    }
    int p1, p2;
    p1 = update_point(left(p), L, (L + R) / 2, idx, new_value);
    p2 = update_point(right(p), (L + R) / 2 + 1, R, idx, new_value);
    return st[p] = (A[p1] <= A[p2]) ? p1 : p2;
  }

 public:
  SegmentTree(const vector<int> &_A) {
    A = _A;
    n = (int)A.size();
    st.assign(4 * n, 0);
    build(1, 0, n - 1);
  }
  int rmq(int i, int j) { return rmq(1, 0, n - 1, i, j); }
  int update_point(int idx, int new_value) {
    return update_point(1, 0, n - 1, idx, new_value);
  }
};
class FenwickTree {
 private:
  vector<int> ft;

 public:
  FenwickTree(int n) { ft.assign(n + 1, 0); }
  int rsq(int b) {
    int sum = 0;
    for (; b; b -= (b & (-b))) sum += ft[b];
    return sum;
  }
  void adjust(int k, int v) {
    for (; k < (int)ft.size(); k += (k & (-k))) {
      ft[k] += v;
    }
  }
};
int fi[1000003];
int la[1000003];
int num[1000003];
int o[1000003];
int main() {
  int n;
  int a[100005];
  scanf("%d", &n);
  for (int i = int(0); i <= int(n - 1); i++) {
    scanf("%d", &a[i]);
  }
  memset((num), 0, sizeof(num));
  memset((fi), 0, sizeof(fi));
  memset((la), 0, sizeof(la));
  for (int i = int(0); i <= int(n - 1); i++) {
    if (fi[a[i]] == 0) {
      fi[a[i]] = i + 1;
      la[a[i]] = i + 1;
      num[a[i]]++;
    } else {
      la[a[i]] = i + 1;
      num[a[i]]++;
    }
  }
  int maxi = a[0], maxn = num[a[0]];
  for (int i = int(1); i <= int(n - 1); i++) {
    if (num[a[i]] > maxn) {
      maxn = num[a[i]];
      maxi = a[i];
    } else if (num[a[i]] == maxn) {
      if ((la[a[i]] - fi[a[i]]) < (la[maxi] - fi[maxi])) {
        maxn = num[a[i]];
        maxi = a[i];
      }
    }
  }
  cout << fi[maxi] << ' ' << la[maxi] << endl;
  return 0;
}
