main = getContents >>= putStrLn . solve . words solve ls = if all (\x -> elem x [show n | n <- [0..12345]]) ls then "OK" else "NG"