#include <bits/stdc++.h>   using namespace std;   struct team {     string name;     int score;     int goals_for;     int goals_against;     int goal_diff() const { return goals_for - goals_against; }   };   bool operator<(const team &A, const team &B) {     if (A.score != B.score) return A.score > B.score;     if (A.goal_diff() != B.goal_diff()) return A.goal_diff() > B.goal_diff();     return A.goals_for > B.goals_for;   }   map<string, team> m;   int main(void) {     int n;     scanf( %d , &n);     for (int i = 0; i < n; ++i) {       static char buff[128];       scanf( %s , buff);       team T;       T.name = string(buff);       T.score = T.goals_against = T.goals_for = 0;       m[T.name] = T;     }     for (int i = 0; i < n * (n - 1) / 2; ++i) {       static char buff[128];       int ga, gb;       scanf( %s %d:%d , buff, &ga, &gb);       string s(buff);       int f = s.find( - );       team &a = m[s.substr(0, f)];       team &b = m[s.substr(f + 1)];       a.goals_for += ga;       a.goals_against += gb;       b.goals_for += gb;       b.goals_against += ga;       if (ga > gb)         a.score += 3;       else if (ga < gb)         b.score += 3;       else {         a.score += 1;         b.score += 1;       }     }     vector<team> teams;     for (map<string, team>::iterator it = m.begin(); it != m.end(); ++it)       teams.push_back(it->second);     sort(teams.begin(), teams.end());     vector<string> ret;     for (int i = 0; i < n / 2; ++i) ret.push_back(teams[i].name);     sort(ret.begin(), ret.end());     for (int i = 0; i < n / 2; ++i) printf( %s n , ret[i].c_str());     return 0;   }   