#include #include #include #include #include #include using namespace std; int main() { string a, b; cin >> a >> b; bool flag = false; if (a.size()!=1 && a[0] == '0')flag = true; for (int i = 0; i < a.size(); i++) { if (a[i] < 48 || a[i]>57)flag = true; } if (!flag) { int na = atoi(a.data()); if (na > 12345)flag = true; } if (b.size()!=1 && b[0] == '0')flag = true; for (int i = 0; i < b.size(); i++) { if (b[i] < 48 || b[i]>57)flag = true; } if (!flag) { int nb = atoi(b.data()); if (nb > 12345)flag = true; } if (flag)cout << "NG" << endl; else cout << "OK" << endl; return 0; }