human
Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision to change some World Cup regulations:

  * the final tournament features n teams (n is always even) 
  * the first n / 2 teams (according to the standings) come through to the knockout stage 
  * the standings are made on the following principle: for a victory a team gets 3 points, for a draw — 1 point, for a defeat — 0 points. In the first place, teams are ordered in the standings in decreasing order of their points.
in the second place — in decreasing order of the difference between scored and missed goals.
in the third place — in the decreasing order of scored goals 
  * it's written in Berland's Constitution that the previous regulation helps to order the teams without ambiguity. 


You are asked to write a program that, by the given list of the competing teams and the results of all the matches, will find the list of teams that managed to get through to the knockout stage.

Input

The first input line contains the only integer n (1 ≤ n ≤ 50) — amount of the teams, taking part in the final tournament of World Cup. The following n lines contain the names of these teams, a name is a string of lower-case and upper-case Latin letters, its length doesn't exceed 30 characters. The following n·(n - 1) / 2 lines describe the held matches in the format name1-name2 num1:num2, where name1, name2 — names of the teams.
num1, num2 (0 ≤ num1, num2 ≤ 100) — amount of the goals, scored by the corresponding teams. Accuracy of the descriptions is guaranteed: there are no two team names coinciding accurate to the letters' case.
there is no match, where a team plays with itself.
each match is met in the descriptions only once.

Output

Output n / 2 lines — names of the teams, which managed to get through to the knockout stage in lexicographical order. Output each name in a separate line. No odd characters (including spaces) are...
Solve the task in PYTHON3.
 What is a Python program to find the list of teams that managed to get through to the knockout stage?
assistant
#Here is Python program to find the list of teams that managed to get through to the knockout stage.

#this function will update information about team after each match
def completeTeamInfo(team,scored,missed):
       team.scoredGoals += scored
       team.missedGoals += missed
       team.differenceScoredAndMissed += scored - missed
       #if the team scored more goals than missed, than it gains 3 points
       if scored > missed:
              team.points += 3
       #if they scored the same amount of goals as they missed, team gains one point
       elif scored == missed:
              team.points += 1
#this function will sort the data according to required conditions
def arrangeTeams(totals):
       totals.sort(key=lambda team: (team.points, team.differenceScoredAndMissed, team.scoredGoals ), reverse=True)
def main():
       #make a class to store all necessary data
       class Team:
              scoredGoals = 0
              missedGoals = 0
              differenceScoredAndMissed = 0
              points = 0
              def __init__(self, name):
                     self.name = name
       #get teams number
       teamsNr = int(input())
       totals = []
       #get team's names
       for _ in range(teamsNr):
              name = input()
              totals.append(Team(name))
       #for each match
       for _ in range(teamsNr*(teamsNr-1)//2):
              #get score and participant teams
              playingTeams,score = input().split()
              #because teams are given in A-C 2:2 form
              #we have to be more accurate in gathering data
              teamOne = playingTeams[:playingTeams.index('-')]
              teamTwo = playingTeams[playingTeams.index('-') + 1:]
              scoreTeamOne = int(score[:score.index(":")])
              scoreTeamTwo = int(score[score.index(':') + 1:])
              #for each match
              for team in totals:
                     #look for team in totals and complete teams info
                     if team.name == teamOne:
                            completeTeamInfo(team,scoreTeamOne,scoreTeamTwo)
                     if team.name ==...