#include #include int main(void){ char s[8],t[8]; int i,l; scanf("%s%s",s,t); l = strlen(s); for(i = 0;i < l;i++){ if(s[i] < 48 || 57 < s[i]){printf("NG\n");return 0;} } if(l != 1 && s[0] == '0'){printf("NG\n");return 0;} l = strlen(t); for(i = 0;i < l;i++){ if(t[i] < 48 || 57 < t[i]){printf("NG\n");return 0;} } if(l != 1 && t[0] == '0'){printf("NG\n");return 0;} if(s[0]*10000+s[1]*1000+s[2]*100+s[3]*10+s[4] > 545673){printf("NG\n");return 0;} if(t[0]*10000+t[1]*1000+t[2]*100+t[3]*10+t[4] > 545673){printf("NG\n");return 0;} printf("OK\n"); return 0; }