puts 2.times.map{ gets.chomp }.all?{|s| s == s.to_i.to_s && s.size <= 5 && s.to_i <= 12345 } ? :OK : :NG