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