-- yukicoder My Practice -- author: Leonardone @ NEETSDKASU main = getContents >>= putStrLn . solve . lines solve [a,b] = if check a && check b then "OK" else "NG" check xs@(x:ys) | checkAllNum xs = let v = read xs in if x == '0' then v == 0 && ys == [] else v <= 12345 | otherwise = False checkAllNum = all (\x -> '0' <= x && x <= '9')