#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;
}
