please check the code i m attesting . I am a beginner on codechef and learning python please help me deduce the error in my program.The program is of beginner level and is related to UEFA league
try:
test_cases=input()
t=int(test_cases)
n=0
while n<t:
i=0
team=dict()
team_diff=dict()
while i<12:
words=input().split(' ')
team1=words[0]
team2=words[4]
if words[1]>words[3]:
team[team1]=team.get(team1,0)+3
elif words[1]==words[3]:
team[team1]=team.get(team1,0)+1
team[team2]=team.get(team2,0)+1
else:
team[team2]=team.get(team2,0)+3
score1=int(words[1])-int(words[3])
score2=(-1)*score1
team_diff[team1]=team_diff.get(team1,0)+score1
team_diff[team2]=team_diff.get(team2,0)+score2
i=i+1
name=list()
x=0
while x<2:
winner=None
for team_name,score in team.items():
if winner is None:
winner=team_name
if score >=team[winner]:
if score>team[winner]:
winner=team_name
else:
if team_diff[team_name]>team_diff[winner]:
winner=team_name
name.append(winner)
if winner in team:
del team[winner]
if winner in team_diff:
del team_diff[winner]
x=x+1
print(name[0],name[1])
n=n+1
except EOFError as e :
pass