#include #include using namespace std; int main() { string s[2]; short cknum[2]; bool flag = false; cin >> s[0] >> s[1]; for (int i = 0; i < 2; i++) { cknum[i] = stoi(s[i]); if (cknum[i]>12345 || s[i].size()>=2 && s[i].at(0) == '0') flag = true; else { for (int j = 0; j < s[i].length(); j++) { if (!(s[i].at(j) >= 48 && s[i].at(j) <= 57)) { flag = true; } } } } cout << (flag ? "NG" : "OK") << endl; return 0; }