#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(T a, string name = "") {
  if (name != "") cerr << name << ":";
  cerr << a;
}
static void print(long long a, string name = "") {
  if (name != "") cerr << name << ":";
  cerr << a << "LL";
}
static void print(string a, string name = "") {
  if (name != "") cerr << name << ":";
  cerr << '"' << a << '"';
}
template <typename T, typename W>
void print(pair<T, W> P, string name = "") {
  if (name != "") cerr << name << ":";
  cerr << "(";
  print(P.first);
  cerr << ",";
  print(P.second);
  cerr << ")";
}
template <typename T>
void print(vector<T> a, string name = "") {
  if (name != "") cerr << name << ":";
  cerr << "{";
  for (int i = 0; i != a.size(); i++) {
    if (i != 0) cerr << ", ";
    print(a[i]);
  }
  cerr << "}" << endl;
}
void printBits(unsigned int x, int end = 32, int start = 0) {
  for (int i = end - 1; i >= start; i--)
    if (x & (1 << i))
      cout << 1 << " ";
    else
      cout << 0 << " ";
}
template <typename T>
void printEndl(T x, string name = "") {
  print(x, name);
  cerr << endl;
}
template <typename T>
vector<T> tokenize(string s, string delim) {
  int i = 0, j = 0;
  vector<T> ret;
  for (; i < s.size(); ++i) {
    j = s.find_first_of(delim, i);
    if (j == -1) j = s.size();
    if (j > i) {
      stringstream in(s.substr(i, j - i));
      T temp;
      in >> temp;
      ret.push_back(temp);
    }
    i = j;
  }
  return ret;
}
template <typename T>
void gcd(T a, T b) {
  return a ? gcd(b % a, a) : b;
}
int bitCount(int x) { return __builtin_popcount(x); }
long long int two(int x) { return (1LL << x); }
bool test(long long int mask, int x) { return (mask & two(x)) > 0; }
template <typename T>
bool checkMax(T& ret, T& cur) {
  if (ret < cur) {
    ret = cur;
    return true;
  }
  return false;
}
template <typename T>
bool checkMin(T& ret, T& cur) {
  if (ret > cur) {
    ret = cur;
    return true;
  }
  return false;
}
const char eof = -123;
int readInt() {
  int x;
  if (scanf("%d", &x) != 1) return eof;
  return x;
}
char readChar() {
  char c;
  if (scanf("%c", &c) != 1) return eof;
  return c;
}
long long int readLL() {
  long long int x;
  if (cin >> x) return x;
  return eof;
}
double readDouble() {
  double f;
  if (scanf("%lf", &f) == 1) return f;
  return eof;
}
map<string, int> M;
string name[50];
int points[50], scored[50], given[50];
int getIndex(string s) {
  if (M.count(s)) return M[s];
  int x = M.size();
  name[x] = s;
  M[s] = x;
  return x;
}
void addGame(string s, string t, int x, int y) {
  int a = getIndex(s);
  int b = getIndex(t);
  points[a] += 3 * (x > y) + 1 * (x == y);
  points[b] += 3 * (y > x) + 1 * (y == x);
  scored[a] += x;
  given[a] += y;
  scored[b] += y;
  given[b] += x;
}
bool cmp(int i, int j) {
  if (points[i] != points[j]) return points[i] > points[j];
  int a = scored[i] - given[i];
  int b = scored[j] - given[j];
  if (a != b) return a > b;
  return scored[i] > scored[j];
}
char buf[1000];
int main() {
  int n = readInt();
  for (int i = 0; i < n; ++i) {
    scanf(" %s", buf);
    getIndex(string(buf));
  }
  int K = n * (n - 1) / 2;
  for (int k = 0; k < K; ++k) {
    string P;
    scanf(" %[^\n]", buf);
    P = buf;
    for (int i = 0; i < P.size(); ++i)
      if (P[i] == '-' || P[i] == ':') P[i] = ' ';
    stringstream in(P);
    string s, t;
    int x, y;
    in >> s >> t >> x >> y;
    addGame(s, t, x, y);
  }
  vector<int> v(n, 0);
  for (int i = 0; i < n; ++i) v[i] = i;
  sort(v.begin(), v.end(), cmp);
  vector<string> ret;
  for (int i = 0; i < (n / 2); ++i) ret.push_back(name[v[i]]);
  sort(ret.begin(), ret.end());
  for (int i = 0; i < ret.size(); ++i) cout << ret[i] << endl;
}
