import sys

sys.stdin = open("agro.in", "r")
sys.stdout = open("agro.out", "w")


n = int(input())
a = list(map(int, input().split()))

ansst, ansfn = 0, 0
st = 0
cur = 1
for i in range(1, n):
    if a[i] == a[i - 1]:
        cur += 1
    else:
        cur = 1
    if cur > 2:
        fn = i - 1
        if fn - st > ansfn - ansst:
            ansst, ansfn = st, fn
        st = i - 1
        cur = 2

fn = n - 1
if fn - st > ansfn - ansst:
    ansst, ansfn = st, fn

print(ansst + 1, ansfn + 1)
