while True:

	try:

		path = [0]*101

		while True:

			a,b = list(map(int, input().split()))

			if a == 0: break

			path[a-1] += 1; path[b-1] += 1

		for i in range(3,101):

			if path[i]%2 != 0:

				flag = 0

				break

		else:

			flag = 1

		if path[0]%2 == path[1]%2 == 1 and  flag:

			print("OK")

		else:

			print("NG")

   	except:

   		break
while True:

	try:

		path = [0]*100

		while True:

			a,b = list(map(int, input().split()))

			if a == 0: break

			path[a-1] += 1; path[b-1] += 1

		if path[0]%2 == path[1]%2 == 1 and sum([x for x in path[2:] if x%2==1]) == 0:

			print("OK")

		else:

			print("NG")

   	except:

   		break
while True:
    try:
        path = [0] * 101
        while True:
            a, b = list(map(int, input().split()))
            if a == 0:
                break
            path[a - 1] += 1
            path[b - 1] += 1
        for i in range(3, 101):
            if path[i] % 2 != 0:
                flag = 0
                break
        else:
            flag = 1
        if path[0] % 2 == path[1] % 2 == 1 and flag:
            print("OK")
        else:
            print("NG")
    except:
        break

while True:
    try:
        path = [0] * 100
        while True:
            a, b = list(map(int, input().split()))
            if a == 0:
                break
            path[a - 1] += 1
            path[b - 1] += 1
        if (
            path[0] % 2 == path[1] % 2 == 1
            and sum([x for x in path[2:] if x % 2 == 1]) == 0
        ):
            print("OK")
        else:
            print("NG")
    except:
        break

-        path = [0] * 101 +        path = [0] * 100 -        for i in range(3, 101): -            if path[i] % 2 != 0: -                flag = 0 -                break -        else: -            flag = 1 -        if path[0] % 2 == path[1] % 2 == 1 and flag: +        if ( +            path[0] % 2 == path[1] % 2 == 1 +            and sum([x for x in path[2:] if x % 2 == 1]) == 0 +        ):