#include using namespace std; bool solve(string s) { //リーディングゼロ if (s.length() != 1 and s[0] == '0') { return false; } //数字以外 for (char i : s) { if (i < '0' or i > '9') { return false; } } //最大値 return (stoi(s) <= 12345); } int main() { string s1, s2; cin >> s1 >> s2; if (solve(s1) and solve(s2)) { cout << "OK" << endl; } else { cout << "NG" << endl; } return 0; }