#include <bits/stdc++.h>
using namespace std;
class Info {
 private:
  string teamName;
  int point;
  int goalDiff;
  int scoredGoals;

 public:
  void setTeamName(string otherTeamName) { this->teamName = otherTeamName; }
  string getTeamName() { return this->teamName; }
  void setPoint(int otherPoint) { this->point = otherPoint; }
  int getPoint() { return this->point; }
  void setGoalDiff(int otherGoalDiff) { this->goalDiff = otherGoalDiff; }
  int getGoalDiff() { return this->goalDiff; }
  void setScoredGoals(int otherScoredGoals) {
    this->scoredGoals = otherScoredGoals;
  }
  int getScoredGoals() { return this->scoredGoals; }
  Info(string newTeamName, int newPoint, int newGoalDiff, int newScoredGoals) {
    this->teamName = newTeamName;
    this->point = newPoint;
    this->goalDiff = newGoalDiff;
    this->scoredGoals = newScoredGoals;
  }
  void printData() {
    cout << endl << "*********************************************" << endl;
    cout << "team name: " << this->teamName << endl;
    cout << "Point: " << this->point << endl;
    cout << "Goal Diff: " << this->goalDiff << endl;
    cout << "Scored Goals: " << this->scoredGoals << endl;
    cout << endl << "*********************************************" << endl;
  }
  ~Info() {}
};
int IndexOf(string& s, char c) {
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == c) return i;
  }
  return -1;
}
int IndexOf(vector<Info>& cont, string& teamName) {
  for (int i = 0; i < cont.size(); i++) {
    if (cont[i].getTeamName() == teamName) return i;
  }
  return -1;
}
bool customCompare(Info& objOne, Info& objTwo) {
  if (objOne.getPoint() != objTwo.getPoint())
    return objOne.getPoint() > objTwo.getPoint();
  if (objOne.getGoalDiff() != objTwo.getGoalDiff())
    return objOne.getGoalDiff() > objTwo.getGoalDiff();
  return objOne.getScoredGoals() > objTwo.getScoredGoals();
}
bool compareByName(Info& objOne, Info& objTwo) {
  string s1 = objOne.getTeamName();
  string s2 = objTwo.getTeamName();
  int s1Len = s1.length();
  int s2Len = s2.length();
  int minLen = (s1Len > s2Len) ? s2Len : s1Len;
  for (int i = 0; i < minLen; i++) {
    if (s1[i] != s2[i]) return s1[i] < s2[i];
  }
  return s1Len < s2Len;
}
int main() {
  int N;
  cin >> N;
  vector<Info> cont;
  for (int i = 0; i < N; i++) {
    string newName;
    cin >> newName;
    Info obj(newName, 0, 0, 0);
    cont.push_back(obj);
  }
  cin >> ws;
  for (int i = 0; i < N * (N - 1) / 2; i++) {
    string s;
    getline(cin, s);
    int dashInd = IndexOf(s, '-');
    int spaceInd = IndexOf(s, ' ');
    int colonInd = IndexOf(s, ':');
    string team1Name = s.substr(0, dashInd);
    string team2Name = s.substr(dashInd + 1, spaceInd - dashInd - 1);
    int goal1 = stoi(s.substr(spaceInd + 1, colonInd - spaceInd - 1));
    int goal2 = stoi(s.substr(colonInd + 1));
    int team1Ind = IndexOf(cont, team1Name);
    int team2Ind = IndexOf(cont, team2Name);
    if (goal1 > goal2)
      cont[team1Ind].setPoint(cont[team1Ind].getPoint() + 3);
    else if (goal1 < goal2)
      cont[team2Ind].setPoint(cont[team2Ind].getPoint() + 3);
    else {
      cont[team1Ind].setPoint(cont[team1Ind].getPoint() + 1);
      cont[team2Ind].setPoint(cont[team2Ind].getPoint() + 1);
    }
    cont[team1Ind].setGoalDiff(cont[team1Ind].getGoalDiff() + (goal1 - goal2));
    cont[team2Ind].setGoalDiff(cont[team2Ind].getGoalDiff() + (goal2 - goal1));
    cont[team1Ind].setScoredGoals(cont[team1Ind].getScoredGoals() + goal1);
    cont[team2Ind].setScoredGoals(cont[team2Ind].getScoredGoals() + goal2);
  }
  sort(cont.begin(), cont.end(), customCompare);
  cont.erase(cont.begin() + N / 2, cont.end());
  sort(cont.begin(), cont.end(), compareByName);
  for (Info item : cont) cout << item.getTeamName() << endl;
}
