#include int toInt(char buf[256], int x) { if( buf[0] == '\0' ) return x; if( not ( '0' <= buf[0] and buf[0] <= '9' ) ) return -1; return toInt(&buf[1], x * 10 + (buf[0] - '0')); } int main() { char buf1[256]; char buf2[256]; scanf("%s", buf1); scanf("%s", buf2); int a = toInt(buf1, 0); int b = toInt(buf2, 0); if( 0 <= a and a <= 12345 and 0 <= b and b <= 12345 and (strlen(buf1) == 1 or buf1[0] != '0') and (strlen(buf2) == 1 or buf2[0] != '0' ) ) { puts("OK"); } else { puts("NG"); } return 0; }