#include #include #include void fail() { std::cout << "NG" << std::endl; std::exit(0); } void solve() { for (int i = 0; i < 2; ++i) { std::string s; std::cin >> s; if (s == "0") continue; if (s.front() == '0') fail(); for (char c : s) { if (!std::isdigit(c)) fail(); } int n = std::stoi(s); if (n > 12345) fail(); } std::cout << "OK" << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }