#include #define rep(i,n) for(int i=0;i<(n);++i) #define all(a) (a).begin(),(a).end() #define dunk(a) cout << (a) << endl using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); string a, b; cin >> a >> b; vector num = { '1','2','3','4','5','6','7','8','9','0' }; int judge1 = 0; int judge2 = 0; rep(i, 10) { judge1 += count(all(a), num[i]); judge2 += count(all(b), num[i]); } if (judge1 != a.size() || judge2 != b.size()) { puts("NG"); return 0; } if (a.substr(0, 2) == "00" || b.substr(0, 2) == "00") { puts("NG"); return 0; } puts("OK"); return 0; }