Problem H
Premier League Table
The Premier League is the highest level of football (soccer, if you must!) in England and is widely considered the best football league in the world. Most football leagues around the world, including the Premier League, use a point system to determine who wins the league trophy.
Each team receives $3$ points for winning a game, $1$ point for drawing (tie), and $0$ for losing. After $38$ games (also called “fixtures”) in a season spanning from August to May, the winner of the league is the team with the most points.
However, if points are tied, it goes to whichever team has the best goal differential (GD) calculated by taking the goals scored (called GF, goals for) minus goals let in (called GA, goals against). Note that goal differential can be a negative number. If neither points nor GD can break the tie, the teams are sorted alphabetically.^{1}
The Premier League needs your help! The company they hired couldn’t figure out how to make the table, so they hired you to create a sorted Premier League table based off of the results of all matches from a season.
Input
The first line of input will be $N$, the number of fixtures to follow. The next $N$ lines will be the scores of each fixture throughout a season in the following format:
Team_One XY Team_Two
where Team_One is the first team and X is their score for that fixture and Team_Two is the second team and Y is their score for that fixture. Both X and Y are guaranteed to be nonnegative numbers.
Input Restrictions

Team names will only have upper and lowercase letters or underscores. No team names will have any whitespace.

The minimum amount of goals scored by either team is $0$, while the maximum is $1\, 000\, 000$.^{2}

The minimum number of unique teams given is $2$, while the maximum is $20$ unique teams.

While a traditional season has $38$ games, the number of games provided in the inputs can be anywhere from $1$ to $10\, 000$.
Output
The output is a sorted league table with each line representing data from a single team. The data on each line should be spaceseparated, and should be as follows:
Team name, how many games the team has played (MP), number of wins, number of draws, number of losses, goals for (GF), goals against (GA), goal differential (GD), and points (PTS).
Each team is uniquely identified by their name in the input; there will be no duplicate team names.
Sorting priority (from highest to lowest) is points $\rightarrow $ GD $\rightarrow $ alphabetical. For instance, if two teams both have $70$ points, then the team with the higher GD will appear earlier in the table. If two teams have both the same number of points and the same GD, then the team whose name comes first alphabetically will appear earlier in the table.
Sample Input 1  Sample Output 1 

2 Manchester_City 13 Liverpool Leicester_City 21 Manchester_United 
Liverpool 1 1 0 0 3 1 2 3 Leicester_City 1 1 0 0 2 1 1 3 Manchester_United 1 0 0 1 1 2 1 0 Manchester_City 1 0 0 1 1 3 2 0 
Sample Input 2  Sample Output 2 

4 Watford 41 Wolves Aston_Villa 31 Burnley Watford 42 Leeds_United Crystal_Palace 24 Aston_Villa 
Watford 2 2 0 0 8 3 5 6 Aston_Villa 2 2 0 0 7 3 4 6 Burnley 1 0 0 1 1 3 2 0 Crystal_Palace 1 0 0 1 2 4 2 0 Leeds_United 1 0 0 1 2 4 2 0 Wolves 1 0 0 1 1 4 3 0 
Footnotes
 No, they don’t use this as the actual tiebreaker.
 Yes, a million goals scored in one game is physically impossible.