import Control.Monad main = do [a,b] <- replicateM 2 getLine putStrLn $ if judge a && judge b then "OK" else "NG" judge :: String -> Bool judge x = (and $ map (`elem` ['0'..'9']) x) && if length x == 1 && head x /= '0' then False else True