#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { string A, B; cin >> A >> B; bool flag = true, t; t = true; for (int i = 0; i < A.size(); i++) { if ((A[i]=='0' && t && A.size() != 1) || ('9' < A[i] || A[i] < '0')) flag = false; if ('1' <= A[i] && A[i] <= '9') t = false; } t = true; for (int i = 0; i < B.size(); i++) { if ((B[i] == '0' && t && B.size() != 1) || ('9' < B[i] || B[i] < '0')) flag = false; if ('1' <= B[i] && B[i] <= '9') t = false; } if (flag) cout << "OK" << endl; else cout << "NG" << endl; return 0; }