#include <bits/stdc++.h>
using namespace std;
long long fastmul(long long a, long long b) {
  if (b == 0) return 0;
  if (b == 1) return a;
  long long tmp = fastmul(a, b >> 1);
  return (b & 1) ? ((tmp << 1) + a) % 1000000007LL : (tmp << 1) % 1000000007LL;
}
struct Point {
  double x, y;
  Point() {}
  Point(double A, double B) : x(A), y(B) {}
};
struct Vec {
  double x, y;
  Vec() {}
  Vec(double A, double B) : x(A), y(B) {}
};
struct line {
  double a, b, c;
  line() {}
  line(double A, double B, double C) : a(A), b(B), c(C) {}
  line(Point A, Point B) {
    a = A.y - B.y;
    b = B.x - A.x;
    c = -a * A.x - b * A.y;
  }
};
Point intersect(line AB, line CD) {
  AB.c = -AB.c;
  CD.c = -CD.c;
  double D = (AB.a * CD.b - AB.b * CD.a);
  double Dx = (AB.c * CD.b - AB.b * CD.c);
  double Dy = (AB.a * CD.c - AB.c * CD.a);
  if (D == 0.0)
    return Point(1e9, 1e9);
  else
    return Point(Dx / D, Dy / D);
}
struct matrix {
  long long a[2 + 5][2 + 5];
  matrix() {}
};
matrix matmul(matrix A, matrix B) {
  matrix c;
  for (int i = 1; i <= 2; i++)
    for (int j = 1; j <= 2; j++) {
      c.a[i][j] = 0;
      for (int k = 1; k <= 2; k++)
        c.a[i][j] = (c.a[i][j] + fastmul(A.a[i][k], B.a[k][j])) % 1000000007LL;
    }
  return c;
}
int n, x, res = 0, cnt[1000005], Start[1000005], Stop[1000005], luui = 0,
          luuj = 0;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (int i = 1; i <= 1000000; i++) Start[i] = long(1e9);
  for (int i = 1; i <= n; i++) {
    cin >> x;
    cnt[x]++;
    Start[x] = min(Start[x], i);
    Stop[x] = max(Stop[x], i);
    res = max(res, cnt[x]);
  }
  int RES = long(1e9);
  for (int i = 1; i <= 1000000; i++) {
    if (cnt[i] == res) {
      if (Stop[i] - Start[i] + 1 < RES) {
        RES = Stop[i] - Start[i] + 1;
        luui = Start[i];
        luuj = Stop[i];
      }
    }
  }
  cout << luui << ' ' << luuj;
  return 0;
}
