#include #include using namespace std; int main(void) { string s[2]; cin >> s[0] >> s[1]; char n[10] = {'0','1','2','3','4','5','6','7','8','9'}; for (int k=0; k<2; k++){ for (int i=0; i < s[k].size(); i++) { bool checked = false; for (int j=0; j < 10; j++) { if (s[k][i] == n[j]) { checked = true; break; } } if (s[k].size() > 1 && s[k][0] == '0') checked = false; if (!checked) { cout << "NG" << endl; return 0; } } } int ai, bi; ai = stoi(s[0]); bi = stoi(s[1]); if (ai>12345 || ai<0 || bi>12345 || bi<0) { cout << "NG" << endl; } else { cout << "OK" << endl; } return 0; }