use std::io; use std::str::FromStr; fn main() { let stdin = io::stdin(); let mut buf = String::new(); stdin.read_line(&mut buf).ok(); let mut it = buf.split_whitespace().map(|n| String::from_str(n).unwrap()); let a = it.next().unwrap(); let mut buf = String::new(); stdin.read_line(&mut buf).ok(); let mut it = buf.split_whitespace().map(|n| String::from_str(n).unwrap()); let b = it.next().unwrap(); if a.chars().nth(0) == Some('0') && a.len() != 1 { println!("NG"); return; } // println!("{}", b); // println!("{:?}", b.chars().nth(0)); if b.chars().nth(0) == Some('0') && b.len() != 1 { println!("NG"); return; } let aa = a.parse::().is_ok(); let bb = b.parse::().is_ok(); if aa && bb { if a.parse::().unwrap() > 12345 { println!("NG"); return; } if b.parse::().unwrap() > 12345 { println!("NG"); return; } println!("OK"); } else { println!("NG"); } }