#include using namespace std; typedef long long ll; bool ok(string s) { if(s == "0") return true; if(s[0] == '0') return false; for(int i = 0; i < s.size(); i++) { if(!isdigit(s[i])) return false; } int n = atoi(s.c_str()); return 0 <= n && n <= 12345; } int main() { cin.tie(0); ios::sync_with_stdio(false); string A, B; cin >> A >> B; if(ok(A) && ok(B)) { cout << "OK" << endl; } else { cout << "NG" << endl; } }