#include using namespace std; bool ok(string A) { for (char x : A) if (!isdigit(x)) return false; if (A != "0" && A[0] == '0') return false; if (A.size() >= 6) return false; return stoi(A) <= 12345; } bool solve() { string A, B; cin >> A >> B; return ok(A) && ok(B); } int main() { puts(solve() ? "OK" : "NG"); }