#include using namespace std; using ll = long long; using Graph = vector>; int main() { string S; cin >> S; string T; cin >> T; string alpha = "0123456789"; int a = 0; int b = 0; int za = 0; int zb = 0; for(int i = 0;i < S.size(); i++) { bool fire = false; for(int j = 0; j < alpha.size(); j++) { if(alpha[j] == S[i]) { fire = true; } } if(fire) { a++; } if('0' == S[0] && i != S.size() - 1) { za++; } } for(int i = 0;i < T.size(); i++) { bool fire = false; for(int j = 0; j < alpha.size(); j++) { if(alpha[j] == T[i]) { fire = true; } } if(fire) { b++; } if('0' == T[0] && i != T.size() - 1) { zb++; } } if(a == S.size() && b == T.size() && za == 0 && zb == 0 && stoi(S) <= 12345 && stoi(T) <= 12345) { cout << "OK" << endl; }else { cout << "NG" << endl; } }