#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a, n;
  map<int, int> freq;
  map<int, pair<int, int> > idx;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a;
    if (!idx[a].first)
      idx[a].first = i;
    else
      idx[a].second = i;
    freq[a]++;
  }
  vector<pair<int, int> > nums;
  vector<int> lol;
  map<int, bool> vis;
  int mx = INT_MIN, number;
  for (map<int, int>::iterator i = freq.begin(); i != freq.end(); ++i) {
    if (mx < i->second) {
      mx = i->second;
    }
  }
  for (map<int, int>::iterator i = freq.begin(); i != freq.end(); ++i) {
    if (mx == i->second) {
      lol.push_back(i->first);
      vis[i->first] = 1;
    }
  }
  if (mx == 1) return cout << 1 << " " << 1 << '\n', 0;
  for (map<int, pair<int, int> >::iterator i = idx.begin(); i != idx.end();
       ++i) {
    if (vis[i->first]) {
      nums.push_back({i->second.first, i->second.second});
    }
  }
  pair<int, int> ans;
  int diff = INT_MAX;
  for (int i = 0; i < nums.size(); ++i) {
    if (nums[i].second - nums[i].first < diff) {
      ans = {nums[i].first, nums[i].second};
      diff = nums[i].second - nums[i].first;
    }
  }
  cout << ans.first << " " << ans.second << '\n';
  return 0;
}
