import Data.Char isNum [] = True isNum (a:as) = if (isDigit a) then (isNum as) else False judge a = (isNum a) && ((read a) <= 12345) f a b = if j == True then "OK" else "NG" where ja = judge a jb = judge b j = (ja == True) && (jb == True) main = do a <- getLine b <- getLine putStrLn $ f a b