#include "bits/stdc++.h" #define _CRT_SECURE_NO_WARNINGS #define rep(i,n) for(int i = 0;i < n;i++) #define REP(i,n,k) for(int i = n;i < k;i++) #define P(p) cout << (p) << endl; #define sP(p) cout << setprecision(15) << fixed << p << endl; #define Pi pair #define IINF 1e9 #define LINF 1e18 #define vi vector using namespace std; typedef long long ll; typedef unsigned long long ull; int dx[] = { 1, -1 , 0 , 0}; int dy[] = { 0, 0, 1, -1}; unsigned long long str_to_int(std::string str) { unsigned long long ret; std::stringstream ss; ss << str; ss >> ret; return ret; } void solve() { string a, b; cin >> a >> b; bool A = false, B = false; rep(i, a.length()) { if ('1' <= a[i] and a[i] <= '9') { A = true; } else if (a[i] == '0') { if (!A and a.length() != 1) { P("NG"); return; } } else { P("NG"); return; } } rep(i, b.length()) { if ('1' <= b[i] and b[i] <= '9') { b = true; } else if (b[i] == '0') { if (!B) { P("NG"); return; } } else { P("NG"); return; } } int x, y; x = str_to_int(a); y = str_to_int(b); if (x > 12345 or y > 12345) { P("NG"); } else { P("OK"); } } int main() { solve(); return 0; }