#include using namespace std; int parse(string x){ int res = 0; for(int i = 0; i < x.size(); ++i){ if('0' > x[i] or '9' < x[i]) return -1; res *= 10; res += x[i]-'0'; } if(res > 12345) return -1; if(x[0] == '0' and res > 0) return -1; return res; } int main(){ string a, b; cin >> a >> b; int A = parse(a), B = parse(b); if(A < 0 or B < 0) cout << "NG" << '\n'; else cout << "OK" << '\n'; return 0; }