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;
struct Reader {
 private:
  static const int BUF_SIZE = 1 << 22;
  char BUF_R[BUF_SIZE], *csy1, *csy2;
  template <class T>
  inline void RI(T& t) {
    int u = 0;
    char c = (csy1 == csy2 &&
                      (csy2 = (csy1 = BUF_R) + fread(BUF_R, 1, BUF_SIZE, stdin),
                       csy1 == csy2)
                  ? EOF
                  : *csy1++);
    for (t = 0; c < 48 || c > 57;
         c = (csy1 == csy2 &&
                      (csy2 = (csy1 = BUF_R) + fread(BUF_R, 1, BUF_SIZE, stdin),
                      csy1 == csy2)
                  ? EOF
                  : *csy1++)) {
      if (c == EOF) return;
      u = c == '-' ? 1 : 0;
    }
    for (; c > 47 && c < 58;
         c = (csy1 == csy2 &&
                      (csy2 = (csy1 = BUF_R) + fread(BUF_R, 1, BUF_SIZE, stdin),
                      csy1 == csy2)
                  ? EOF
                  : *csy1++))
      t = (t << 1) + (t << 3) + c - 48;
    t = u ? -t : t;
  }
  template <class T>
  inline void RU(T& t) {
    char c = (csy1 == csy2 &&
                      (csy2 = (csy1 = BUF_R) + fread(BUF_R, 1, BUF_SIZE, stdin),
                       csy1 == csy2)
                  ? EOF
                  : *csy1++);
    for (t = 0; c < 48 || c > 57;
         c = (csy1 == csy2 &&
                      (csy2 = (csy1 = BUF_R) + fread(BUF_R, 1, BUF_SIZE, stdin),
                      csy1 == csy2)
                  ? EOF
                  : *csy1++))
      if (c == EOF) return;
    for (; c > 47 && c < 58;
         c = (csy1 == csy2 &&
                      (csy2 = (csy1 = BUF_R) + fread(BUF_R, 1, BUF_SIZE, stdin),
                      csy1 == csy2)
                  ? EOF
                  : *csy1++))
      t = (t << 1) + (t << 3) + c - 48;
  }

 public:
  inline Reader& operator>>(char& c) {
    c = (csy1 == csy2 &&
                 (csy2 = (csy1 = BUF_R) + fread(BUF_R, 1, BUF_SIZE, stdin),
                  csy1 == csy2)
             ? EOF
             : *csy1++);
    return *this;
  }
  inline Reader& operator>>(int& t) {
    RI(t);
    return *this;
  }
  inline Reader& operator>>(long long& t) {
    RI(t);
    return *this;
  }
  inline Reader& operator>>(char* s) {
    char c = (csy1 == csy2 &&
                      (csy2 = (csy1 = BUF_R) + fread(BUF_R, 1, BUF_SIZE, stdin),
                       csy1 == csy2)
                  ? EOF
                  : *csy1++);
    for (*s = 0; c < 33;
         c = (csy1 == csy2 &&
                      (csy2 = (csy1 = BUF_R) + fread(BUF_R, 1, BUF_SIZE, stdin),
                      csy1 == csy2)
                  ? EOF
                  : *csy1++))
      if (c == EOF) return *this;
    for (; c > 32;
         c = (csy1 == csy2 &&
                      (csy2 = (csy1 = BUF_R) + fread(BUF_R, 1, BUF_SIZE, stdin),
                      csy1 == csy2)
                  ? EOF
                  : *csy1++))
      *s++ = c;
    *s = 0;
    return *this;
  }
} Dieulouard;
struct Writer {
 private:
  static const int BUF_SIZE = 1 << 22;
  char BUF_W[BUF_SIZE], *csy;
  inline void WC(const char c) {
    if (csy - BUF_W == BUF_SIZE)
      fwrite(BUF_W, 1, BUF_SIZE, stdout), csy = BUF_W;
    *csy++ = c;
  }
  template <class T>
  inline void WI(T x) {
    static int sta[38];
    int top = 0;
    if (x < 0) {
      WC('-');
      do sta[top++] = -(x % 10);
      while (x /= 10);
    } else
      do sta[top++] = x % 10;
      while (x /= 10);
    while (top) WC(sta[--top] + '0');
  }

 public:
  Writer() : csy(BUF_W) {}
  ~Writer() { fwrite(BUF_W, 1, csy - BUF_W, stdout); }
  inline void flush() {
    fwrite(BUF_W, 1, csy - BUF_W, stdout);
    csy = BUF_W;
  }
  inline Writer& operator<<(const char c) {
    WC(c);
    return *this;
  }
  inline Writer& operator<<(int x) {
    WI(x);
    return *this;
  }
  inline Writer& operator<<(long long x) {
    WI(x);
    return *this;
  }
  inline Writer& operator<<(const char* s) {
    while (*s) WC(*s++);
    return *this;
  }
} Houffalize;
const int N = 100005;
const int M = 1000005;
int n, a[N], cnt[M], left_pos[M], right_pos[M], maxcnt;
int len = 1e9, _l, _r;
int main() {
  Dieulouard >> n;
  for (int i = 1; i <= n; ++i) {
    Dieulouard >> a[i];
    if (!left_pos[a[i]]) left_pos[a[i]] = i;
    cnt[a[i]]++;
  }
  for (int i = n; i > 0; --i) {
    if (!right_pos[a[i]]) right_pos[a[i]] = i;
    maxcnt = max(maxcnt, cnt[a[i]]);
  }
  for (int i = 1; i < M; ++i) {
    if (cnt[i] == maxcnt) {
      if (len > right_pos[i] - left_pos[i] + 1) {
        len = right_pos[i] - left_pos[i] + 1;
        _l = left_pos[i], _r = right_pos[i];
      } else if (len == right_pos[i] - left_pos[i] + 1 && _l > left_pos[i]) {
        _l = left_pos[i];
        _r = right_pos[i];
      }
    }
  }
  Houffalize << _l << " " << _r << '\n';
  return 0;
}