import Data.List
main = mapM_ (putStrLn . solve) . lines =<< getContents
solve t = intercalate " " . map show $ f 1 t
f i (a:b:ts)
  |a==b = [i,i+1]
f i (a:b:c:ts)
  |a==c = [i,i+2]
  |otherwise = f (i+1) (b:c:ts)
f _ _ = [-1,-1]