#include using namespace std; int main(){ string a,b;cin>>a>>b; int A = 0; for(int i = 0; a.size() > i; i++){ if(a == "0")break; if(!i){ if(!('0' < a[i] && a[i] <= '9')){ cout <<"NG" << endl; return 0; } }else{ if(!('0' < a[i] && a[i] <= '9')){ cout <<"NG" << endl; return 0; } } A = A*10+a[i]-'0'; } int B = 0; for(int i = 0; b.size() > i; i++){ if(b == "0")break; if(!i){ if(!('0' < b[i] && b[i] <= '9')){ cout <<"NG" << endl; return 0; } }else{ if(!('0' < b[i] && b[i] <= '9')){ cout <<"NG" << endl; return 0; } } B = B*10+b[i]-'0'; } if(A <= 12345 && B <= 12345){ cout << "OK" << endl; }else{ cout << "NG" << endl; } }