#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<cassert>
#include<queue>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

bool isNum(string S) {
	if (S == "0") return true;
	if (S[0] == '0') return false;
	for (char c : S) {
		if ('0' <= c && c <= '9') {

		} else return false;
	}
	return true;
}

void no() {
	cout << "NG" << endl;
	exit(0);
}

int main() {
	string A, B;
	cin >> A >> B;
	if (!isNum(A) || !isNum(B)) no();
	int a = stoi(A), b = stoi(B);
	if (a < 0 || a > 12345) no();
	if (b < 0 || b > 12345) no();
	cout << "OK" << endl;
	return 0;
}