#define _GLIBCXX_DEBUG #define ll long long #define INF 1000000000; #define INF_B 1000000000000000000; #include using namespace std; using Graph = vector>; int main(){ string A, B; cin >> A >> B; if((int)A.size() != 1 and A[0] == '0'){ cout << "NG" << endl; return 0; } int a = 0; for(int i = 0; i < (int)A.size(); i++){ if(!('0' <= A[i] and A[i] <= '9')){ cout << "NG" << endl; return 0; } a *= 10; a += A[i] - '0'; } if((int)B.size() != 1 and B[0] == '0'){ cout << "NG" << endl; return 0; } int b = 0; for(int i = 0; i < (int)B.size(); i++){ if(!('0' <= B[i] and B[i] <= '9')){ cout << "NG" << endl; return 0; } b *= 10; b += B[i] - '0'; } if(a > 12345 or b > 12345){ cout << "NG" << endl; return 0; } cout << "OK" << endl; }