Buggy python submission (verdict: Runtime Error):
#coding:utf-8
while 1:
    try:
        #初期化
        key=[]
        for i in range(101):
            key.append(0)
        flag = 0
        #オイラー路：すべての頂点のうち、次数が奇数であるものがちょうど２つ(入口と出口)
        while 1:
            input = map(int, raw_input().split())
            if(input[0] == 0 and input[1] == 0):
                break
            key[input[0]]+=1
            key[input[1]]+=1

        for v in key:
            if v%2 == 1:
                flag+=1
        if(flag == 2 or flag == 0):
            print "OK"
        else:
            print "NG"
    except:
        break

Fixed submission:
#coding:utf-8
while 1:
    try:
        #初期化
        key=[0]*101
        #オイラー路：すべての頂点のうち、次数が奇数であるものがちょうど２つ(入口と出口)
        while 1:
            input = map(int, raw_input().split())
            if(input[0] == 0 and input[1] == 0):
                break
            key[input[0]]+=1
            key[input[1]]+=1

        if(key[1]%2 == 1 and key[2]%2==1 and len(filter(lambda x:x%2==1,key[3:]))==0):
            print "OK"
        else:
            print "NG"
    except:
        break

Buggy python submission (verdict: Runtime Error):
while True:
    try:
        path = [0]*100
        while True:
            a,b = map(int, raw_input().split())
            if a == 0: break
            path[a-1] += 1; path[b-1] += 1
        if (path[0]%2 == path[1]%2 == 1 ):
            print "OK"
        else:
            print "NG"
    except:
        break

Fixed submission:
#coding:utf-8
while 1:
    try:
        #初期化
        key=[0]*101
        #オイラー路：すべての頂点のうち、次数が奇数であるものがちょうど２つ(入口と出口)
        while 1:
            input = map(int, raw_input().split())
            if(input[0] == 0 and input[1] == 0):
                break
            key[input[0]]+=1
            key[input[1]]+=1

        if(key[1]%2 == 1 and key[2]%2==1 and len(filter(lambda x:x%2==1,key[3:]))==0):
            print "OK"
        else:
            print "NG"
    except:
        break

Buggy python submission (verdict: Runtime Error):
while True:
    try:
        path = [0]*100
        while True:
            a,b = map(int, raw_input().split())
            if a == 0: break
            path[a-1] += 1; path[b-1] += 1
        if (path[0]%2 == 1 and path[1]%2 == 1 ):
            print "OK"
        else:
            print "NG"
    except:
        break

Fixed submission:
#coding:utf-8
while 1:
    try:
        #初期化
        key=[0]*101
        #オイラー路：すべての頂点のうち、次数が奇数であるものがちょうど２つ(入口と出口)
        while 1:
            input = map(int, raw_input().split())
            if(input[0] == 0 and input[1] == 0):
                break
            key[input[0]]+=1
            key[input[1]]+=1

        if(key[1]%2 == 1 and key[2]%2==1 and len(filter(lambda x:x%2==1,key[3:]))==0):
            print "OK"
        else:
            print "NG"
    except:
        break

Buggy python submission (verdict: Runtime Error):
#coding:utf-8
        #初期化
        key=[0]*101
        flag = 0;
        #オイラー路：すべての頂点のうち、次数が奇数であるものがちょうど２つ(入口と出口)
        while 1:
            input = map(int, raw_input().split())
            if(input[0] == 0 and input[1] == 0):
                break
            key[input[0]]+=1
            key[input[1]]+=1

        for v in key:
            if v%2 == 1:
                flag+=1
        if(flag == 2):
            print "OK"
        else:
            print "NG"

Fixed submission:
#coding:utf-8
while 1:
    try:
        #初期化
        key=[0]*101
        #オイラー路：すべての頂点のうち、次数が奇数であるものがちょうど２つ(入口と出口)
        while 1:
            input = map(int, raw_input().split())
            if(input[0] == 0 and input[1] == 0):
                break
            key[input[0]]+=1
            key[input[1]]+=1

        if(key[1]%2 == 1 and key[2]%2==1 and len(filter(lambda x:x%2==1,key[3:]))==0):
            print "OK"
        else:
            print "NG"
    except:
        break

Buggy python submission (verdict: Runtime Error):
#coding:utf-8
while 1:
    try:
        #初期化
        key=[0]*101
        #オイラー路：すべての頂点のうち、次数が奇数であるものがちょうど２つ(入口と出口)
        while 1:
            input = map(int, raw_input().split())
            if(input[0] == 0 and input[1] == 0):
                break
            key[input[0]]+=1
            key[input[1]]+=1

        if(key[1]%2 == 1 and key[2]%2==1 and len(filter(lambda x:x%2=1,key[3:]))==0):
            print "OK"
        else:
            print "NG"
    except:
        break

Fixed submission:
#coding:utf-8
while 1:
    try:
        #初期化
        key=[0]*101
        #オイラー路：すべての頂点のうち、次数が奇数であるものがちょうど２つ(入口と出口)
        while 1:
            input = map(int, raw_input().split())
            if(input[0] == 0 and input[1] == 0):
                break
            key[input[0]]+=1
            key[input[1]]+=1

        if(key[1]%2 == 1 and key[2]%2==1 and len(filter(lambda x:x%2==1,key[3:]))==0):
            print "OK"
        else:
            print "NG"
    except:
        break