#include <bits/stdc++.h>
using namespace std;
inline int read(){
int x=0;bool f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=0;ch=getchar();}
while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
return f?x:-x;
}
struct tem{
int pt,wg,goal;
};
map<string,tem> mp;
inline int p(int x){
return x>0?3:(x?0:1);
}
inline bool cmp(tem x,tem y){
return (x.pt^y.pt)?(x.pt>y.pt):(x.wg^y.wg)?(x.wg>y.wg):x.goal>y.goal;
}
int n,pos,a,b;
string s,str,st;
int main(){
n=read();
for(int i(1);i<=(n*(n+1)>>1);i++){
cin>>s;
pos=0,str="",st="";
for(pos=0;s[pos]^'-';pos++)
str=str+s[pos];
for(pos++;pos<s.length();pos++)
st=st+s[pos];
a=read(),b=read();
mp[str].goal+=a,mp[st].goal+=b;
mp[str].wg+=a-b,mp[st].wg+=b-a;
mp[str].pt+=p(a-b),mp[st].pt+=p(b-a);
}
for(map<string,tem>::iterator it=mp.begin();it!=mp.end();it++)
for(map<string,tem>::iterator jt=it;jt!=mp.end();jt++)
if(cmp(jt->second,it->second))
swap(*it,*jt);
int i=1;
for(map<string,tem>::iterator it=mp.begin();i*2<=n;it++,i++)
cout<<(it->first)<<endl;
return 0;
}