#include #include #include #include #include #include #include #include #include #include #include #include #define mod 1000000007; using namespace std; typedef long long ll; typedef pair Pr; string A, B; int main() { cin >> A >> B; for (int i = 0; i < A.size(); i++) { if (!(A[i] >= '0' && A[i] <= '9')) { cout << "NG" << endl; return 0; } } for (int i = 0; i < B.size(); i++) { if (!(B[i] >= '0' && B[i] <= '9')) { cout << "NG" << endl; return 0; } } int len_a = A.size(), len_b = B.size(); string num_a = to_string(stoi(A)), num_b = to_string(stoi(B)); if (len_a != num_a.size() || len_b != num_b.size() || stoi(num_a) > 12345 || stoi(num_b) > 12345) { cout << "NG" << endl; } else cout << "OK" << endl; return 0; }