#define _USE_MATH_DEFINES #include //cin, cout #include //vector #include //sort,min,max,count #include //string,getline, to_string #include //abs(int) #include //swap, pair #include //tuple #include //deque #include //INT_MAX #include //bitset #include //sqrt, ceil. M_PI, pow, sin #include //fixed #include //setprecision #include //stringstream #include //gcd, assumlate #include //randam_device #include //numeric_limits #include using namespace std; constexpr long long int D_MOD = 1000000007; int main() { string A, B; cin >> A >> B; bool flg = true; if (A.size() > 5) { flg = false; } if (flg && B.size() > 5) { flg = false; } if (flg) { for (unsigned int i = 0; i < A.size(); i++) { if (A.at(i) < '0' || '9' < A.at(i)) { flg = false; break; } } } if (flg) { for (unsigned int i = 0; i < B.size(); i++) { if (B.at(i) < '0' || '9' < B.at(i)) { flg = false; break; } } } if (flg) { int a = stoi(A); if (a < 0 || 12345 < a) { flg = false; } } if (flg) { int b = stoi(B); if (b < 0 || 12345 < b) { flg = false; } } if (flg) { cout << "OK" << endl; } else { cout << "NG" << endl; } return 0; }