#include #define FOR(i,a,b) for(int i = (a); i < (b); ++i) #define REP(i,n) FOR(i,0,n) #define SZ(n) (int)(n).size() #define ALL(n) (n).begin(), (n).end() #define MOD % 1000000007 using namespace std; typedef long long LL; typedef vector VI; int main() { string a, b; cin >> a >> b; bool bo = true; REP(i, SZ(a)) if ('0' > a[i] || a[i] > '9' || SZ(a) > 4 && a[i] > ('0' + i)) bo = false; REP(i, SZ(b)) if ('0' > b[i] || b[i] > '9' || SZ(b) > 4 && b[i] > ('0' + i)) bo = false; if (SZ(a) > 1 && a[0] == '0' || SZ(b) > 1 && b[0] == '0') bo = false; if (bo) cout << "OK" << endl; else cout << "NG" << endl; return 0; }