import Data.List (subsequences, findIndex)
import Data.Maybe (fromMaybe)

main = putStrLn =<< solve <$> getLine

solve :: String -> String
solve s = unwords [show (a + 1), show (b + 1)] where
    (a, b) = solve' s

solve' :: String -> (Int, Int)
solve' = fromMaybe (-1, -1) . findUnBalanceIndex

findUnBalanceIndex :: String -> Maybe (Int, Int)
findUnBalanceIndex s = fmap (\i -> (i, i + 2)) $ findIndex isUnbalance $ window' s

isUnbalance :: String -> Bool
isUnbalance [a, b, c] = a == b || b == c || c == a
isUnbalance s = error $ "length s must be 3 but " ++ (show $ length s)

window :: Int -> [a] -> [[a]]
window n xs = undefined

window' :: [a] -> [[a]]
window' [] = []
window' [a] = []
window' [a, b] = []
window' xs = take 3 xs : window' (tail xs)
