#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <sstream>
#include <cmath>
#include <limits>
#include <utility>
#include <iomanip>
#include <set>
#include <numeric>
#include <cassert>
#include <ctime>
#define INF_MAX 2147483647
#define INF_MIN -2147483647
#define INF_LL 9223372036854775807LL
#define INF 2000000000
#define PI acos(-1.0)
#define EPS 1e-8
#define LL long long
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define setzero(a) memset(a,0,sizeof(a))
#define setdp(a) memset(a,-1,sizeof(a))
#define bits(a) __builtin_popcount(a)
using namespace std;
int m[1000005], L[1000005];
int main()
{
//ios_base::sync_with_stdio(0);
//freopen("lca.in", "r", stdin);
//freopen("lca.out", "w", stdout);
int n, x, maxi = 0, mini = INF, ch = -1;
scanf("%d", &n);
for(int i=0;i<n;i++)
{
scanf("%d", &x);
if(m[x] == 0)
{
L[x] = i;
m[x] = 1;
}
else m[x]++;
if(m[x] > maxi)
{
maxi = m[x];
mini = i - L[x] + 1;
ch = L[x] + 1;
}
else if(m[x] == maxi && i - L[x] + 1 < mini)
{
mini = i - L[x] + 1;
ch = L[x] + 1;
}
}
cout << ch << " " << ch + mini - 1;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0ZGlvPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8Y3N0cmluZz4KI2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPGNjdHlwZT4KI2luY2x1ZGUgPHN0YWNrPgojaW5jbHVkZSA8cXVldWU+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxtYXA+CiNpbmNsdWRlIDxzc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+CiNpbmNsdWRlIDxsaW1pdHM+CiNpbmNsdWRlIDx1dGlsaXR5PgojaW5jbHVkZSA8aW9tYW5pcD4KI2luY2x1ZG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