#include using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) bool check(const string &s) { for (char c: s) if (!isdigit(c)) return false; if (s.length() > 1 && s[0] == '0') return false; int x = stoi(s); return 0 <= x && x <= 12345; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); string a, b; cin >> a >> b; if (check(a) && check(b)) cout << "OK" << endl; else cout << "NG" << endl; return 0; }