#include <bits/stdc++.h>
using namespace std;
template <class T1>
void debug(T1 e) {
  cout << e << endl;
}
template <class T1, class T2>
void debug(T1 e1, T2 e2) {
  cout << e1 << "\t" << e2 << endl;
}
template <class T1, class T2, class T3>
void debug(T1 e1, T2 e2, T3 e3) {
  cout << e1 << "\t" << e2 << "\t" << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void debug(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << "\t" << e2 << "\t" << e3 << "\t" << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void debug(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << "\t" << e2 << "\t" << e3 << "\t" << e4 << "\t" << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void debug(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << "\t" << e2 << "\t" << e3 << "\t" << e4 << "\t" << e5 << "\t"
       << e6 << endl;
}
template <class T>
void debug(vector<vector<T> > e, int row, int col) {
  int i, j;
  for (i = 0; i < row; i++) {
    for (j = 0; j < col; j++) cout << e[i][j] << " ";
    cout << endl;
  }
  cout << endl;
}
template <class T>
void debug(vector<basic_string<T> > e, int row, int col) {
  int i, j;
  for (i = 0; i < row; i++) {
    for (j = 0; j < col; j++) cout << e[i][j];
    cout << endl;
  }
  cout << endl;
}
template <class T>
void debug(T e[110][110], int row, int col) {
  int i, j;
  for (i = 0; i < row; i++) {
    for (j = 0; j < col; j++) cout << e[i][j] << " ";
    cout << endl;
  }
}
template <class T>
string toString(T n) {
  ostringstream oss;
  oss << n;
  oss.flush();
  return oss.str();
}
int toInt(string s) {
  int r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
bool isVowel(char ch) {
  ch = tolower(ch);
  if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u')
    return true;
  return false;
}
bool isUpper(char c) { return c >= 'A' && c <= 'Z'; }
bool isLower(char c) { return c >= 'a' && c <= 'z'; }
int main() {
  vector<int> counta, last_pos, first_pos;
  counta.clear();
  last_pos.clear();
  first_pos.clear();
  int n;
  int i;
  cin >> n;
  for (i = 0; i <= 1000008; i++) {
    counta.push_back(0);
    first_pos.push_back(0);
    last_pos.push_back(0);
  }
  int maximum = 0;
  int minNum = 1000000;
  int maxNum = 0;
  vector<int> V;
  V.clear();
  for (i = 1; i <= n; i++) {
    int temp = 0;
    cin >> temp;
    V.push_back(temp);
    if (counta[temp] == 0) {
      counta[temp]++;
      first_pos[temp] = i;
      last_pos[temp] = i;
    } else {
      counta[temp]++;
      last_pos[temp] = i;
    }
    if (counta[temp] > maximum) {
      maximum = counta[temp];
    }
    if (temp < minNum) {
      minNum = temp;
    }
    if (temp > maxNum) {
      maxNum = temp;
    }
  }
  int start = 0, endd = 0, length = 10000000;
  sort(V.begin(), V.end());
  for (i = 0; i <= n - 1; i++) {
    if (counta[V[i]] == maximum) {
      int tstart = first_pos[V[i]];
      int tendd = last_pos[V[i]];
      int tlength = tendd - tstart;
      if (tlength < length) {
        length = tlength;
        start = tstart;
        endd = tendd;
      }
    }
  }
  cout << start << " " << endd << endl;
  return 0;
}
