#include using namespace std; #define REP(i,n) for(int i=0; i<(n); i++) struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star; bool check( string S ) { REP( i, (int)S.size() ) { if( ( S[ 0 ] == '0' && S.size() > 1 ) || isalpha( S[ i ] ) ) { return false; } } int N = stoi( S ); if( N > 12345 ) { return false; } return true; } int main() { string A, B; cin >> A >> B; cout << ( check( A ) && check( B ) ? "OK" : "NG" ) << endl; return 0; }