#include #include #include #include #include #include #include #include #include #include #include #include //#include using namespace std; //STL output ******************************** templateinline std::ostream& operator << (std::ostream& os, const std::pair& p) { return os << "(" << p.first << ", " << p.second << ")"; } templateinline std::ostream &operator<<(std::ostream &os, const std::vector& v) { bool first = true; os << "["; for (unsigned int i = 0; i < v.size(); i++) { if (!first)os << ", "; os << v[i]; first = false; }return os << "]"; } inline std::ostream &operator<<(std::ostream &os, const std::vector& v) { bool first = true; os << "["; for (unsigned int i = 0; i < v.size(); i++) { if (!first)os << ", "; os << "'" << v[i] << "'"; first = false; }return os << "]"; } templatevoid printarray(T a[], T2 sz, T2 beg = 0) { for (T2 i = beg; i < sz; ++i) cout << a[i] << " "; cout << endl; } int main() { string a, b; getline(cin, a); getline(cin, b); bool flag = false; if (a != "0" && a[0] == '0') flag = true; if (b != "0" && b[0] == '0') flag = true; if (flag) { cout << "NG\n"; return 0; } for (char c : a) if (!isdigit(c)) { flag = true; break; } for (char c : b) if (!isdigit(c)) { flag = true; break; } if (flag) { cout << "NG\n"; return 0; } int A, B; istringstream ss(a + " " + b); ss >> A >> B; if (A > 12345 || B > 12345) { cout << "NG\n"; return 0; } cout << "OK\n"; return 0; }