#include using namespace std; struct Initializer { Initializer() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(15); } } initializer; template inline T toInteger(const string&); template<> inline int toInteger(const string& s) { return stoi(s); } template<> inline long toInteger(const string& s) { return stol(s); } template<> inline long long toInteger(const string& s) { return stoll(s); } template inline T toInteger(const string& s, int n) { T res = 0; for (char c : s) { if (isdigit(c)) res = res * n + c - '0'; else if (isalpha(c)) res = res * n + tolower(c) - 'a' + 10; } return s[0] == '-' ? -res : res; } bool is_valid(string s) { for (char c : s) if (!isdigit(c)) return false; if (s.size() != 1u && s[0] == '0') return false; int n = toInteger(s); return 0 <= n && n <= 12345; } int main() { string a, b; cin >> a >> b; cout << (is_valid(a) && is_valid(b) ? "OK" : "NG") << endl; }