#include using namespace std; bool ok(string S){ int N = S.size(); if (N > 1 && S[0] == '0'){ return false; } for (int i = 0; i < N; i++){ if (!('0' <= S[i] && S[i] <= '9')){ return false; } } if (stoi(S) > 12345){ return false; } return true; } int main(){ string A; cin >> A; string B; cin >> B; if (ok(A) && ok(B)){ cout << "OK" << endl; } else { cout << "NG" << endl; } }