#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); string a, b; cin >> a >> b; for(int i = 0; i < a.size(); i++) { if(a[i] < '0' || a[i] > '9') { cout << "NG" << endl; return 0; } } for(int i = 0; i < b.size(); i++) { if(b[i] < '0' || b[i] > '9') { cout << "NG" << endl; return 0; } } bool nzero = false; for(int i = 0; i < a.size(); i++) { if(!nzero && b[i] == '0') { cout << "NG" << endl; return 0; } if(b[i] != '0') nzero = true; } nzero = false; for(int i = 0; i < b.size(); i++) { if(!nzero && b[i] == '0') { cout << "NG" << endl; return 0; } if(b[i] != '0') nzero = true; } int x = stoi(a), y = stoi(b); if(x > 12345 || x < 0) { cout << "NG" << endl; return 0; } if(y > 12345 || y < 0) { cout << "NG" << endl; return 0; } cout << "OK" << endl; return 0; }