-- Try AtCoder
-- author: Leonardone @ NEETSDKASU
 
import qualified Data.Map as Map
import Data.List (find)
import Data.Array (listArray, (!))

main = putStrLn . solve =<< getLine

solve xs = ans where
    a = listArray (1, length xs) xs
    h = Map.singleton (a ! 1) 1
    mn k = k - 1
    g i j m | i == j = (i, j, m)
    g i j m =
        let
            x = Map.adjust mn (a ! i) m
            mx = maximum $ Map.elems x
            l = j - i + 1
        in
            if l <= mx * 2 then
                (i + 1, j, x)
            else
                g (i + 1) j x
    f _ j _ | j > length xs = "-1 -1"
    f i j m =
        let
            x = Map.insertWith (+) (a ! j) 1 m
            mx = maximum $ Map.elems x
            l = j - i + 1
        in
            if l > 1 && l < mx * 2 then
                show i ++ " " ++ show j
            else
                let (ii, jj, xx) = g i j x
                in f ii (jj + 1) xx
    ans = f 1 2 h
    