use std::io::stdin; fn get_line() -> String { let mut s = String::new(); stdin().read_line(&mut s).ok(); s.trim().to_string() } fn main() { let a = get_line(); let b = get_line(); let ar: Result = a.parse(); let br: Result = b.parse(); println!("{}", if let Ok(an) = ar { if let Ok(bn) = br { let m = 12346; if (format!("{}", an) == a) && (format!("{}", bn) == b) && an < m && bn < m { "OK" } else { "NG" } } else { "NG" } } else { "NG" } ); }