#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); string A, B; cin >> A >> B; function check = [](string s) { for (int i = 0; i < (int)s.size(); i++) { if (!('0' <= s[i] && s[i] <= '9')) return false; } int x = stoi(s); return x <= 12345 && !((int)s.size() > 1 && s[0] == '0'); }; if (check(A) && check(B)) { cout << "OK" << '\n'; } else { cout << "NG" << '\n'; } return 0; }