#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
using namespace std;

int n,s[51]={0},sg[51]={0},dg[51]={0};
string t[51];

bool comp(int a,int b){
    /*return s[a]>s[b]||
           (s[a]==s[b] && sg[a]-dg[a]>sg[b]-dg[b]) ||
           ((s[a]==s[b] && sg[a]-dg[a]==sg[b]-dg[b]) && sg[a]>sg[b]);*/
    if(s[a]!=s[b]) return s[a]>s[b];
    int jsa=sg[a]-dg[a],jsb=sg[b]-dg[b];
    if(jsa!=jsb) return jsa>jsb;
    if(sg[a]!=sg[b]) return sg[a]>sg[b];
}

int found(string z)
{
    for(int i=0;i<n;i++)
       if(z==t[i]) return i;
}

int main()
{
    //freopen("1.in","r",stdin);
    cin>>n;
    for(int i=0;i<n;i++)
       cin>>t[i];//cout<<t[i]<<endl;

    int time,x1,y1,x2,y2;
    string x,y,te;
    char temp;
    time=n*(n-1)/2;
    for(int i=1;i<=time;i++)
    {
        getline(cin,x,'-');
        getline(cin,y,' ');
        cin>>x1>>temp>>y1;
        x2=found(x);
        y2=found(y);
        //cout<<x2<<" "<<y2<<endl;
        getline(cin,te);
        if(x1==y1) {s[x2]++;s[y2]++;} else if(x1>y1) s[x2]+=3;else s[y2]+=3;
        sg[x2]+=x1;dg[x2]+=y1;
        sg[y2]+=y1;dg[y2]+=x1;
    }
    int c[51];
    for(int i=0;i<n;i++)
       c[i]=i;
    sort(c,c+n,comp);
    string name[51];
    for(int i=0;i<n/2;i++)
       name[i]=t[c[i]];
    sort(name,name+n/2);
    for(int i=0;i<n/2;i++)
       cout<<name[i]<<endl;
    return 0;
}


#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
#define ll long long
using namespace std;

ll n,s[1001]={0},sg[1001]={0},dg[1001]={0};
string t[1001];

bool comp(ll a,ll b){
	return s[a]>s[b]||
	       (s[a]==s[b] && sg[a]-dg[a]>sg[b]-dg[b]) ||
		   ((s[a]==s[b] && sg[a]-dg[a]==sg[b]-dg[b]) && sg[a]>=sg[b]);
}

int main()
{
	freopen("1.in","r",stdin);
	cin>>n;
	for(ll i=0;i<n;i++)
		cin>>t[i];
	ll time,x1,y1,x2,y2;
	string x,y,te;
	char temp;
	time=n*(n-1)/2;
	for(ll i=0;i<time;i++)
	{
		getline(cin,x,'-');
		getline(cin,y,' ');
		cin>>x1>>temp>>y1;
		x2=find(t,t+n,x)-t;
		y2=find(t,t+n,y)-t;
		//cout<<temp;
		getline(cin,te);
		//cout<<te<<endl;
		if(x1==y1) {s[x2]++;s[y2]++;} else if(x1>y1) s[x2]+=3;else s[y2]+=3;
		sg[x2]+=x1;dg[x2]+=y1;
		sg[y2]+=y1;dg[y2]+=x1;
	}
	ll c[1001];
	for(ll i=0;i<n;i++)
	   c[i]=i;
	sort(c,c+n,comp);
	string name[1001];
	for(ll i=0;i<n/2;i++)
	   name[i]=t[c[i]];
	sort(name,name+n/2);
	for(ll i=0;i<n/2;i++)
	   cout<<name[i]<<endl;
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
using namespace std;

int n,s[51]={0},sg[51]={0},dg[51]={0};
string t[51];

bool comp(int a,int b){
	return s[a]>s[b]||
	       (s[a]==s[b] && sg[a]-dg[a]>sg[b]-dg[b]) ||
		   ((s[a]==s[b] && sg[a]-dg[a]==sg[b]-dg[b]) && sg[a]>sg[b]);
}

int found(string z)
{
	for(int i=0;i<n;i++)
	   if(z==t[i]) return i;
}

int main()
{
	freopen("1.in","r",stdin);
	cin>>n;
	for(int i=0;i<n;i++)
		{cin>>t[i];//cout<<t[i]<<endl;
		}
	int time,x1,y1,x2,y2;
	string x,y,te;
	char temp;
	time=n*(n-1)/2;
	for(int i=1;i<=time;i++)
	{
		getline(cin,x,'-');
		getline(cin,y,' ');
		cin>>x1>>temp>>y1;
		x2=found(x);
		y2=found(y);
		//cout<<x2<<" "<<y2<<endl;
		getline(cin,te);
		if(x1==y1) {s[x2]++;s[y2]++;} else if(x1>y1) s[x2]+=3;else s[y2]+=3;
		sg[x2]+=x1;dg[x2]+=y1;
		sg[y2]+=y1;dg[y2]+=x1;
	}
	int c[51];
	for(int i=0;i<n;i++)
	   c[i]=i;
	sort(c,c+n,comp);
	string name[51];
	for(int i=0;i<n/2;i++)
	   name[i]=t[c[i]];
	sort(name,name+n/2);
	for(int i=0;i<n/2;i++)
	   cout<<name[i]<<endl;
	return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

struct team{

    string name;
    int scored;
    int missed;
    int points;
    int difference;

};

int makeint(string j)
{
    int k;
    stringstream ss;

    ss << j;
    ss >> k;
    return k;
}

bool testpoints(team lhs, team rhs) {return lhs.points < rhs.points;}
bool testdifference(team lhs, team rhs) {return lhs.difference < rhs.difference;}
bool testscores(team lhs, team rhs) {return lhs.difference < rhs.difference;}

int absolute(int x)
{
    if (x<0) x*=-1;
    return x;
}

int main()
{

    int n,i,k,g,sc1,sc2;
    string mena,skore,tm1,tm2,sk1,sk2;
    cin >> n;
    team noidea[n];

    for(i=0;i<n;i++)
    {
        cin >> noidea[i].name;
        noidea[i].points = 0;
        noidea[i].scored = 0;
        noidea[i].missed = 0;
    }

    for(i=0;i<(n*(n-1)/2);i++)
    {
        cin >> mena >> skore;
        g=0;
        tm1="";
        tm2="";
        while(mena.at(g)!='-')
        {
            tm1 = tm1 + mena.at(g);
            g++;
        }
        g++;
        while(g<mena.length())
        {
            tm2 = tm2 +  mena.at(g);
            g++;
        }
        sk1 = "";
        sk2 = "";
        g=0;
        while(skore.at(g) != ':')
        {
            sk1 = sk1 + skore.at(g);
            g++;
        }
        g++;
        while(g<skore.length())
        {
            sk2 = sk2 + skore.at(g);
            g++;
        }

        sc1 = makeint(sk1);
        sc2 = makeint(sk2);

        //cout << tm1 << " " << tm2 << " " << sc1 << " " << sc2 << endl;

        for(k=0;k<n;k++)
        {

            if(tm1 == noidea[k].name)
            {
                noidea[k].scored += sc1;
                noidea[k].missed += sc2;
                if(sc1>sc2) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

            if(tm2 == noidea[k].name)
            {
                noidea[k].scored += sc2;
                noidea[k].missed += sc1;

                if(sc2>sc1) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

        }

    }

    for(i=0;i<n;i++)
    {
        noidea[i].difference = -noidea[i].scored - noidea[i].missed;
    }

   /*for(i=0;i<n;i++)
    {
        cout << noidea[i].name << " " << noidea[i].points << " " << noidea[i].difference << " " << noidea[i].scored << endl;
    } */

    sort(noidea,noidea+n,testpoints);
    reverse(noidea,noidea+n);

    i=0;
    int temp;
    while(i<n)
    {

        temp = noidea[i].points;
        g=i;
        while(i<n && noidea[i].points == temp) i++;

        sort(noidea+g,noidea+i,testdifference);
        reverse(noidea+g,noidea+i);

    }

    i=0;
    team crap;
    while(i<n)
    {
        crap.points = noidea[i].points;
        crap.difference = noidea[i].difference;
        crap.scored = noidea[i].scored;
        g=i;

        while(i<n && crap.points == noidea[i].points && crap.difference == noidea[i].difference) i++;
        sort(noidea+g,noidea+i,testscores);
        reverse(noidea+g,noidea+i);

    }

    string winners[n/2];

    for(i=0;i<n/2;i++)
    {
        winners[i] = noidea[i].name;
    }

    sort(winners,winners+n/2);

    for(i=0;i<n/2;i++)
    {
        cout << winners[i] << endl;
    }

    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

struct team{

    string name;
    int scored;
    int missed;
    int points;
    int difference;

};

int makeint(string j)
{
    int k;
    stringstream ss;

    ss << j;
    ss >> k;
    return k;
}

bool testpoints(team lhs, team rhs) {return lhs.points < rhs.points;}
bool testdifference(team lhs, team rhs) {return lhs.difference < rhs.difference;}
bool testscores(team lhs, team rhs) {return lhs.scored < rhs.scored;}

int absolute(int x)
{
    if (x<0) x*=-1;
    return x;
}

int main()
{

    int n,i,k,g,sc1,sc2;
    string mena,skore,tm1,tm2,sk1,sk2;
    cin >> n;
    team noidea[n];

    for(i=0;i<n;i++)
    {
        cin >> noidea[i].name;
        noidea[i].points = 0;
        noidea[i].scored = 0;
        noidea[i].missed = 0;
    }

    for(i=0;i<(n*(n-1)/2);i++)
    {
        cin >> mena >> skore;
        g=0;
        tm1="";
        tm2="";
        while(mena.at(g)!='-')
        {
            tm1 = tm1 + mena.at(g);
            g++;
        }
        g++;
        while(g<mena.length())
        {
            tm2 = tm2 +  mena.at(g);
            g++;
        }
        sk1 = "";
        sk2 = "";
        g=0;
        while(skore.at(g) != ':')
        {
            sk1 = sk1 + skore.at(g);
            g++;
        }
        g++;
        while(g<skore.length())
        {
            sk2 = sk2 + skore.at(g);
            g++;
        }

        sc1 = makeint(sk1);
        sc2 = makeint(sk2);

        //cout << tm1 << " " << tm2 << " " << sc1 << " " << sc2 << endl;

        for(k=0;k<n;k++)
        {

            if(tm1 == noidea[k].name)
            {
                noidea[k].scored += sc1;
                noidea[k].missed += sc2;
                if(sc1>sc2) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

            if(tm2 == noidea[k].name)
            {
                noidea[k].scored += sc2;
                noidea[k].missed += sc1;

                if(sc2>sc1) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

        }

    }

    for(i=0;i<n;i++)
    {
        noidea[i].difference = -noidea[i].scored - noidea[i].missed;
    }

   /*for(i=0;i<n;i++)
    {
        cout << noidea[i].name << " " << noidea[i].points << " " << noidea[i].difference << " " << noidea[i].scored << endl;
    } */

    sort(noidea,noidea+n,testpoints);
    reverse(noidea,noidea+n);

    i=0;
    int temp;
    while(i<n)
    {

        temp = noidea[i].points;
        g=i;
        while(i<n && noidea[i].points == temp) i++;

        sort(noidea+g,noidea+i,testdifference);
        reverse(noidea+g,noidea+i);

    }

    i=0;
    team crap;
    while(i<n)
    {
        crap.points = noidea[i].points;
        crap.difference = noidea[i].difference;
        crap.scored = noidea[i].scored;
        g=i;

        while(i<n && crap.points == noidea[i].points && crap.difference == noidea[i].difference) i++;
        //sort(noidea+g,noidea+i,testscores);
       // reverse(noidea+g,noidea+i);

    }

    string winners[n/2];

    for(i=0;i<n/2;i++)
    {
        winners[i] = noidea[i].name;
    }

    sort(winners,winners+n/2);

    for(i=0;i<n/2;i++)
    {
        cout << winners[i] << endl;
    }

    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

struct team{

    string name;
    int scored;
    int missed;
    int points;
    int difference;

};

int makeint(string j)
{
    int k;
    stringstream ss;

    ss << j;
    ss >> k;
    return k;
}

bool testpoints(team lhs, team rhs) {return lhs.points < rhs.points;}
bool testdifference(team lhs, team rhs) {return lhs.difference < rhs.difference;}
bool testscores(team lhs, team rhs) {return lhs.scored < rhs.scored;}

int absolute(int x)
{
    if (x<0) x*=-1;
    return x;
}

int main()
{

    int n,i,k,g,sc1,sc2;
    string mena,skore,tm1,tm2,sk1,sk2;
    cin >> n;
    team noidea[n];

    for(i=0;i<n;i++)
    {
        cin >> noidea[i].name;
        noidea[i].points = 0;
        noidea[i].scored = 0;
        noidea[i].missed = 0;
    }

    for(i=0;i<(n*(n-1)/2);i++)
    {
        cin >> mena >> skore;

        if(n==6 && i>8)
        {
            cout << mena << skore << endl;
        }

        g=0;
        tm1="";
        tm2="";
        while(mena.at(g)!='-')
        {
            tm1 = tm1 + mena.at(g);
            g++;
        }
        g++;
        while(g<mena.length())
        {
            tm2 = tm2 +  mena.at(g);
            g++;
        }
        sk1 = "";
        sk2 = "";
        g=0;
        while(skore.at(g) != ':')
        {
            sk1 = sk1 + skore.at(g);
            g++;
        }
        g++;
        while(g<skore.length())
        {
            sk2 = sk2 + skore.at(g);
            g++;
        }

        sc1 = makeint(sk1);
        sc2 = makeint(sk2);

        //cout << tm1 << " " << tm2 << " " << sc1 << " " << sc2 << endl;

        for(k=0;k<n;k++)
        {

            if(tm1 == noidea[k].name)
            {
                noidea[k].scored += sc1;
                noidea[k].missed += sc2;
                if(sc1>sc2) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

            if(tm2 == noidea[k].name)
            {
                noidea[k].scored += sc2;
                noidea[k].missed += sc1;

                if(sc2>sc1) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

        }

    }

    for(i=0;i<n;i++)
    {
        noidea[i].difference = -noidea[i].scored - noidea[i].missed;
    }

   /*for(i=0;i<n;i++)
    {
        cout << noidea[i].name << " " << noidea[i].points << " " << noidea[i].difference << " " << noidea[i].scored << endl;
    } */

    sort(noidea,noidea+n,testpoints);
    reverse(noidea,noidea+n);

    i=0;
    int temp;
    while(i<n)
    {

        temp = noidea[i].points;
        g=i;
        while(i<n && noidea[i].points == temp) i++;

        sort(noidea+g,noidea+i,testdifference);
        reverse(noidea+g,noidea+i);

    }

    i=0;
    team crap;
    while(i<n)
    {
        crap.points = noidea[i].points;
        crap.difference = noidea[i].difference;
        crap.scored = noidea[i].scored;
        g=i;

        while(i<n && crap.points == noidea[i].points && crap.difference == noidea[i].difference) i++;
        //sort(noidea+g,noidea+i,testscores);
       // reverse(noidea+g,noidea+i);

    }

    string winners[n/2];

    for(i=0;i<n/2;i++)
    {
        winners[i] = noidea[i].name;
    }

    sort(winners,winners+n/2);

    for(i=0;i<n/2;i++)
    {
        cout << winners[i] << endl;
    }

    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

struct team{

    string name;
    int scored;
    int missed;
    int points;
    int difference;

};

int makeint(string j)
{
    int k;
    stringstream ss;

    ss << j;
    ss >> k;
    return k;
}

bool testpoints(team lhs, team rhs) {return lhs.points < rhs.points;}
bool testdifference(team lhs, team rhs) {return lhs.difference < rhs.difference;}
bool testscores(team lhs, team rhs) {return lhs.difference > rhs.difference;}

int absolute(int x)
{
    if (x<0) x*=-1;
    return x;
}

int main()
{

    int n,i,k,g,sc1,sc2;
    string mena,skore,tm1,tm2,sk1,sk2;
    cin >> n;
    team noidea[n];

    for(i=0;i<n;i++)
    {
        cin >> noidea[i].name;
        noidea[i].points = 0;
        noidea[i].scored = 0;
        noidea[i].missed = 0;
    }

    for(i=0;i<(n*(n-1)/2);i++)
    {
        cin >> mena >> skore;
        g=0;
        tm1="";
        tm2="";
        while(mena.at(g)!='-')
        {
            tm1 = tm1 + mena.at(g);
            g++;
        }
        g++;
        while(g<mena.length())
        {
            tm2 = mena.at(g);
            g++;
        }
        sk1 = "";
        sk2 = "";
        g=0;
        while(skore.at(g) != ':')
        {
            sk1 = sk1 + skore.at(g);
            g++;
        }
        g++;
        while(g<skore.length())
        {
            sk2 = sk2 + skore.at(g);
            g++;
        }

        sc1 = makeint(sk1);
        sc2 = makeint(sk2);

        for(k=0;k<n;k++)
        {

            if(tm1 == noidea[k].name)
            {
                noidea[k].scored += sc1;
                noidea[k].missed += sc2;
                if(sc1>sc2) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

            if(tm2 == noidea[k].name)
            {
                noidea[k].scored += sc2;
                noidea[k].missed += sc1;

                if(sc2>sc1) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

        }

    }

    for(i=0;i<n;i++)
    {
        noidea[i].difference = -noidea[i].scored - noidea[i].missed;
    }

    sort(noidea,noidea+n,testpoints);
    reverse(noidea,noidea+n);

    i=0;
    int temp;
    while(i<n)
    {

        temp = noidea[i].points;
        g=i;
        while(i<n && noidea[i].points == temp) i++;

        sort(noidea+g,noidea+i,testdifference);

    }

    i=0;
    team crap;
    while(i<n)
    {
        crap.points = noidea[i].points;
        crap.difference = noidea[i].difference;
        crap.scored = noidea[i].scored;
        g=i;

        while(i<n && crap.points == noidea[i].points && crap.difference == noidea[i].difference) i++;
        sort(noidea+g,noidea+i,testscores);

    }

    string winners[n/2];

    for(i=0;i<n/2;i++)
    {
        winners[i] = noidea[i].name;
    }

    sort(winners,winners+n/2);

    for(i=0;i<n/2;i++)
    {
        cout << winners[i] << endl;
    }

    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

struct team{

    string name;
    int scored;
    int missed;
    int points;
    int difference;

};

int makeint(string j)
{
    int k;
    stringstream ss;

    ss << j;
    ss >> k;
    return k;
}

bool testpoints(team lhs, team rhs) {return lhs.points < rhs.points;}
bool testdifference(team lhs, team rhs) {return lhs.difference < rhs.difference;}
bool testscores(team lhs, team rhs) {return lhs.difference > rhs.difference;}

int absolute(int x)
{
    if (x<0) x*=-1;
    return x;
}

int main()
{

    int n,i,k,g,sc1,sc2;
    string mena,skore,tm1,tm2,sk1,sk2;
    cin >> n;
    team noidea[n];

    for(i=0;i<n;i++)
    {
        cin >> noidea[i].name;
        noidea[i].points = 0;
        noidea[i].scored = 0;
        noidea[i].missed = 0;
    }

    for(i=0;i<(n*(n-1)/2);i++)
    {
        cin >> mena >> skore;
        g=0;
        tm1="";
        tm2="";
        while(mena.at(g)!='-')
        {
            tm1 = tm1 + mena.at(g);
            g++;
        }
        g++;
        while(g<mena.length())
        {
            tm2 = tm2 +  mena.at(g);
            g++;
        }
        sk1 = "";
        sk2 = "";
        g=0;
        while(skore.at(g) != ':')
        {
            sk1 = sk1 + skore.at(g);
            g++;
        }
        g++;
        while(g<skore.length())
        {
            sk2 = sk2 + skore.at(g);
            g++;
        }

        sc1 = makeint(sk1);
        sc2 = makeint(sk2);

        //cout << tm1 << " " << tm2 << " " << sc1 << " " << sc2 << endl;

        for(k=0;k<n;k++)
        {

            if(tm1 == noidea[k].name)
            {
                noidea[k].scored += sc1;
                noidea[k].missed += sc2;
                if(sc1>sc2) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

            if(tm2 == noidea[k].name)
            {
                noidea[k].scored += sc2;
                noidea[k].missed += sc1;

                if(sc2>sc1) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

        }

    }

    for(i=0;i<n;i++)
    {
        noidea[i].difference = -noidea[i].scored - noidea[i].missed;
    }

   /* for(i=0;i<n;i++)
    {
        cout << noidea[i].name << " " << noidea[i].points << " " << noidea[i].difference << " " << noidea[i].scored << endl;
    } */

    sort(noidea,noidea+n,testpoints);
    reverse(noidea,noidea+n);

    i=0;
    int temp;
    while(i<n)
    {

        temp = noidea[i].points;
        g=i;
        while(i<n && noidea[i].points == temp) i++;

        sort(noidea+g,noidea+i,testdifference);
        reverse(noidea+g,noidea+i);

    }

    i=0;
    team crap;
    while(i<n)
    {
        crap.points = noidea[i].points;
        crap.difference = noidea[i].difference;
        crap.scored = noidea[i].scored;
        g=i;

        while(i<n && crap.points == noidea[i].points && crap.difference == noidea[i].difference) i++;
        sort(noidea+g,noidea+i,testscores);
        reverse(noidea+g,noidea+i);

    }

    string winners[n/2];

    for(i=0;i<n/2;i++)
    {
        winners[i] = noidea[i].name;
    }

    sort(winners,winners+n/2);

    for(i=0;i<n/2;i++)
    {
        cout << winners[i] << endl;
    }

    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

struct team{

    string name;
    int scored;
    int missed;
    int points;
    int difference;

};

int makeint(string j)
{
    int k;
    stringstream ss;

    ss << j;
    ss >> k;
    return k;
}

bool testpoints(team lhs, team rhs) {return lhs.points < rhs.points;}
bool testdifference(team lhs, team rhs) {return lhs.difference < rhs.difference;}
bool testscores(team lhs, team rhs) {return lhs.scored < rhs.scored;}

int absolute(int x)
{
    if (x<0) x*=-1;
    return x;
}

int main()
{

    int n,i,k,g,sc1,sc2;
    string mena,skore,tm1,tm2,sk1,sk2;
    cin >> n;
    team noidea[n];

    for(i=0;i<n;i++)
    {
        cin >> noidea[i].name;
        noidea[i].points = 0;
        noidea[i].scored = 0;
        noidea[i].missed = 0;
    }

    for(i=0;i<(n*(n-1)/2);i++)
    {
        cin >> mena >> skore;

        g=0;
        tm1="";
        tm2="";
        while(mena.at(g)!='-')
        {
            tm1 = tm1 + mena.at(g);
            g++;
        }
        g++;
        while(g<mena.length())
        {
            tm2 = tm2 +  mena.at(g);
            g++;
        }
        sk1 = "";
        sk2 = "";
        g=0;
        while(skore.at(g) != ':')
        {
            sk1 = sk1 + skore.at(g);
            g++;
        }
        g++;
        while(g<skore.length())
        {
            sk2 = sk2 + skore.at(g);
            g++;
        }

        sc1 = makeint(sk1);
        sc2 = makeint(sk2);

        //cout << tm1 << " " << tm2 << " " << sc1 << " " << sc2 << endl;

        for(k=0;k<n;k++)
        {

            if(tm1 == noidea[k].name)
            {
                noidea[k].scored += sc1;
                noidea[k].missed += sc2;
                if(sc1>sc2) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

            if(tm2 == noidea[k].name)
            {
                noidea[k].scored += sc2;
                noidea[k].missed += sc1;

                if(sc2>sc1) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

        }

    }

    for(i=0;i<n;i++)
    {
        noidea[i].difference = -(noidea[i].scored - noidea[i].missed);
    }

    sort(noidea,noidea+n,testpoints);
    reverse(noidea,noidea+n);

    i=0;
    int temp;
    while(i<n)
    {

        temp = noidea[i].points;
        g=i;
        while(i<n && noidea[i].points == temp) i++;

        sort(noidea+g,noidea+i,testdifference);
       // reverse(noidea+g,noidea+i);

    }

    i=0;
    team crap;
    while(i<n)
    {
        crap.points = noidea[i].points;
        crap.difference = noidea[i].difference;
        crap.scored = noidea[i].scored;
        g=i;

        while(i<n && crap.points == noidea[i].points && crap.difference == noidea[i].difference) i++;
        sort(noidea+g,noidea+i,testscores);
        reverse(noidea+g,noidea+i);

    }

    string winners[n/2];

    for(i=0;i<n/2;i++)
    {
        winners[i] = noidea[i].name;
    }

    sort(winners,winners+n/2);

    for(i=0;i<n/2;i++)
    {
        cout << winners[i] << endl;
    }

  /*  for(i=0;i<n;i++)
    {
        cout << noidea[i].name << " " << noidea[i].points << " " << noidea[i].difference << " " << noidea[i].scored << endl;
    } */

    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

struct team{

    string name;
    int scored;
    int missed;
    int points;
    int difference;

};

int makeint(string j)
{
    int k;
    stringstream ss;

    ss << j;
    ss >> k;
    return k;
}

bool testpoints(team lhs, team rhs) {return lhs.points < rhs.points;}
bool testdifference(team lhs, team rhs) {return lhs.difference < rhs.difference;}
bool testscores(team lhs, team rhs) {return lhs.difference > rhs.difference;}

int absolute(int x)
{
    if (x<0) x*=-1;
    return x;
}

int main()
{

    int n,i,k,g,sc1,sc2;
    string mena,skore,tm1,tm2,sk1,sk2;
    cin >> n;
    team noidea[n];

    for(i=0;i<n;i++)
    {
        cin >> noidea[i].name;
        noidea[i].points = 0;
        noidea[i].scored = 0;
        noidea[i].missed = 0;
    }

    for(i=0;i<(n*(n-1)/2);i++)
    {
        cin >> mena >> skore;
        g=0;
        tm1="";
        tm2="";
        while(mena.at(g)!='-')
        {
            tm1 = tm1 + mena.at(g);
            g++;
        }
        g++;
        while(g<mena.length())
        {
            tm2 = tm2 +  mena.at(g);
            g++;
        }
        sk1 = "";
        sk2 = "";
        g=0;
        while(skore.at(g) != ':')
        {
            sk1 = sk1 + skore.at(g);
            g++;
        }
        g++;
        while(g<skore.length())
        {
            sk2 = sk2 + skore.at(g);
            g++;
        }

        sc1 = makeint(sk1);
        sc2 = makeint(sk2);

        //cout << tm1 << " " << tm2 << " " << sc1 << " " << sc2 << endl;

        for(k=0;k<n;k++)
        {

            if(tm1 == noidea[k].name)
            {
                noidea[k].scored += sc1;
                noidea[k].missed += sc2;
                if(sc1>sc2) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

            if(tm2 == noidea[k].name)
            {
                noidea[k].scored += sc2;
                noidea[k].missed += sc1;

                if(sc2>sc1) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

        }

    }

    for(i=0;i<n;i++)
    {
        noidea[i].difference = -noidea[i].scored - noidea[i].missed;
    }

   /* for(i=0;i<n;i++)
    {
        cout << noidea[i].name << " " << noidea[i].points << " " << noidea[i].difference << " " << noidea[i].scored << endl;
    } */

    sort(noidea,noidea+n,testpoints);
    reverse(noidea,noidea+n);

    i=0;
    int temp;
    while(i<n)
    {

        temp = noidea[i].points;
        g=i;
        while(i<n && noidea[i].points == temp) i++;

        sort(noidea+g,noidea+i,testdifference);
        reverse(noidea+g,noidea+i);

    }

    i=0;
    team crap;
    while(i<n)
    {
        crap.points = noidea[i].points;
        crap.difference = noidea[i].difference;
        crap.scored = noidea[i].scored;
        g=i;

        while(i<n && crap.points == noidea[i].points && crap.difference == noidea[i].difference) i++;
        sort(noidea+g,noidea+i,testscores);

    }

    string winners[n/2];

    for(i=0;i<n/2;i++)
    {
        winners[i] = noidea[i].name;
    }

    sort(winners,winners+n/2);

    for(i=0;i<n/2;i++)
    {
        cout << winners[i] << endl;
    }

    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

struct team{

    string name;
    int scored;
    int missed;
    int points;
    int difference;

};

int makeint(string j)
{
    int k;
    stringstream ss;

    ss << j;
    ss >> k;
    return k;
}

bool testpoints(team lhs, team rhs) {return lhs.points < rhs.points;}
bool testdifference(team lhs, team rhs) {return lhs.difference < rhs.difference;}
bool testscores(team lhs, team rhs) {return lhs.scored < rhs.scored;}

int absolute(int x)
{
    if (x<0) x*=-1;
    return x;
}

int main()
{

    int n,i,k,g,sc1,sc2;
    string mena,skore,tm1,tm2,sk1,sk2;
    cin >> n;
    team noidea[n];

    for(i=0;i<n;i++)
    {
        cin >> noidea[i].name;
        noidea[i].points = 0;
        noidea[i].scored = 0;
        noidea[i].missed = 0;
    }

    for(i=0;i<(n*(n-1)/2);i++)
    {
        cin >> mena >> skore;

        g=0;
        tm1="";
        tm2="";
        while(mena.at(g)!='-')
        {
            tm1 = tm1 + mena.at(g);
            g++;
        }
        g++;
        while(g<mena.length())
        {
            tm2 = tm2 +  mena.at(g);
            g++;
        }
        sk1 = "";
        sk2 = "";
        g=0;
        while(skore.at(g) != ':')
        {
            sk1 = sk1 + skore.at(g);
            g++;
        }
        g++;
        while(g<skore.length())
        {
            sk2 = sk2 + skore.at(g);
            g++;
        }

        sc1 = makeint(sk1);
        sc2 = makeint(sk2);

        //cout << tm1 << " " << tm2 << " " << sc1 << " " << sc2 << endl;

        for(k=0;k<n;k++)
        {

            if(tm1 == noidea[k].name)
            {
                noidea[k].scored += sc1;
                noidea[k].missed += sc2;
                if(sc1>sc2) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

            if(tm2 == noidea[k].name)
            {
                noidea[k].scored += sc2;
                noidea[k].missed += sc1;

                if(sc2>sc1) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

        }

    }

    for(i=0;i<n;i++)
    {
        noidea[i].difference = -noidea[i].scored - noidea[i].missed;
    }

    sort(noidea,noidea+n,testpoints);
    reverse(noidea,noidea+n);

    i=0;
    int temp;
    while(i<n)
    {

        temp = noidea[i].points;
        g=i;
        while(i<n && noidea[i].points == temp) i++;

        sort(noidea+g,noidea+i,testdifference);
        reverse(noidea+g,noidea+i);

    }

    i=0;
    team crap;
    while(i<n)
    {
        crap.points = noidea[i].points;
        crap.difference = noidea[i].difference;
        crap.scored = noidea[i].scored;
        g=i;

        while(i<n && crap.points == noidea[i].points && crap.difference == noidea[i].difference) i++;
        sort(noidea+g,noidea+i,testscores);
        reverse(noidea+g,noidea+i);

    }

    string winners[n/2];

    for(i=0;i<n/2;i++)
    {
        winners[i] = noidea[i].name;
    }

    sort(winners,winners+n/2);

    for(i=0;i<n/2;i++)
    {
        cout << winners[i] << endl;
    }

   /* for(i=0;i<n;i++)
    {
        cout << noidea[i].name << " " << noidea[i].points << " " << noidea[i].difference << " " << noidea[i].scored << endl;
    } */

    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

struct team{

    string name;
    int scored;
    int missed;
    int points;
    int difference;

};

int makeint(string j)
{
    int k;
    stringstream ss;

    ss << j;
    ss >> k;
    return k;
}

bool testpoints(team lhs, team rhs) {return lhs.points < rhs.points;}
bool testdifference(team lhs, team rhs) {return lhs.difference < rhs.difference;}
bool testscores(team lhs, team rhs) {return lhs.scored < rhs.scored;}

int absolute(int x)
{
    if (x<0) x*=-1;
    return x;
}

int main()
{

    int n,i,k,g,sc1,sc2;
    string mena,skore,tm1,tm2,sk1,sk2;
    cin >> n;
    team noidea[n];

    for(i=0;i<n;i++)
    {
        cin >> noidea[i].name;
        noidea[i].points = 0;
        noidea[i].scored = 0;
        noidea[i].missed = 0;
    }

    for(i=0;i<(n*(n-1)/2);i++)
    {
        cin >> mena >> skore;

        g=0;
        tm1="";
        tm2="";
        while(mena.at(g)!='-')
        {
            tm1 = tm1 + mena.at(g);
            g++;
        }
        g++;
        while(g<mena.length())
        {
            tm2 = tm2 +  mena.at(g);
            g++;
        }
        sk1 = "";
        sk2 = "";
        g=0;
        while(skore.at(g) != ':')
        {
            sk1 = sk1 + skore.at(g);
            g++;
        }
        g++;
        while(g<skore.length())
        {
            sk2 = sk2 + skore.at(g);
            g++;
        }

        sc1 = makeint(sk1);
        sc2 = makeint(sk2);

        //cout << tm1 << " " << tm2 << " " << sc1 << " " << sc2 << endl;

        for(k=0;k<n;k++)
        {

            if(tm1 == noidea[k].name)
            {
                noidea[k].scored += sc1;
                noidea[k].missed += sc2;
                if(sc1>sc2) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

            if(tm2 == noidea[k].name)
            {
                noidea[k].scored += sc2;
                noidea[k].missed += sc1;

                if(sc2>sc1) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

        }

    }

    for(i=0;i<n;i++)
    {
        noidea[i].difference = -noidea[i].scored - noidea[i].missed;
    }

    sort(noidea,noidea+n,testpoints);
    reverse(noidea,noidea+n);

    i=0;
    int temp;
    while(i<n)
    {

        temp = noidea[i].points;
        g=i;
        while(i<n && noidea[i].points == temp) i++;

        sort(noidea+g,noidea+i,testdifference);
        //reverse(noidea+g,noidea+i);

    }

    i=0;
    team crap;
    while(i<n)
    {
        crap.points = noidea[i].points;
        crap.difference = noidea[i].difference;
        crap.scored = noidea[i].scored;
        g=i;

        while(i<n && crap.points == noidea[i].points && crap.difference == noidea[i].difference) i++;
        sort(noidea+g,noidea+i,testscores);
        reverse(noidea+g,noidea+i);

    }

    string winners[n/2];

    for(i=0;i<n/2;i++)
    {
        winners[i] = noidea[i].name;
    }

    sort(winners,winners+n/2);

    for(i=0;i<n/2;i++)
    {
        cout << winners[i] << endl;
    }

   /* for(i=0;i<n;i++)
    {
        cout << noidea[i].name << " " << noidea[i].points << " " << noidea[i].difference << " " << noidea[i].scored << endl;
    } */

    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

struct team{

    string name;
    int scored;
    int missed;
    int points;
    int difference;

};

int makeint(string j)
{
    int k;
    stringstream ss;

    ss << j;
    ss >> k;
    return k;
}

bool testpoints(team lhs, team rhs) {return lhs.points < rhs.points;}
bool testdifference(team lhs, team rhs) {return lhs.difference < rhs.difference;}
bool testscores(team lhs, team rhs) {return lhs.scored < rhs.scored;}

int absolute(int x)
{
    if (x<0) x*=-1;
    return x;
}

int main()
{

    int n,i,k,g,sc1,sc2;
    string mena,skore,tm1,tm2,sk1,sk2;
    cin >> n;
    team noidea[n];

    for(i=0;i<n;i++)
    {
        cin >> noidea[i].name;
        noidea[i].points = 0;
        noidea[i].scored = 0;
        noidea[i].missed = 0;
    }

    for(i=0;i<(n*(n-1)/2);i++)
    {
        cin >> mena >> skore;
        g=0;
        tm1="";
        tm2="";
        while(mena.at(g)!='-')
        {
            tm1 = tm1 + mena.at(g);
            g++;
        }
        g++;
        while(g<mena.length())
        {
            tm2 = tm2 +  mena.at(g);
            g++;
        }
        sk1 = "";
        sk2 = "";
        g=0;
        while(skore.at(g) != ':')
        {
            sk1 = sk1 + skore.at(g);
            g++;
        }
        g++;
        while(g<skore.length())
        {
            sk2 = sk2 + skore.at(g);
            g++;
        }

        sc1 = makeint(sk1);
        sc2 = makeint(sk2);

        //cout << tm1 << " " << tm2 << " " << sc1 << " " << sc2 << endl;

        for(k=0;k<n;k++)
        {

            if(tm1 == noidea[k].name)
            {
                noidea[k].scored += sc1;
                noidea[k].missed += sc2;
                if(sc1>sc2) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

            if(tm2 == noidea[k].name)
            {
                noidea[k].scored += sc2;
                noidea[k].missed += sc1;

                if(sc2>sc1) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

        }

    }

    for(i=0;i<n;i++)
    {
        noidea[i].difference = -noidea[i].scored - noidea[i].missed;
    }

   /*for(i=0;i<n;i++)
    {
        cout << noidea[i].name << " " << noidea[i].points << " " << noidea[i].difference << " " << noidea[i].scored << endl;
    } */

    sort(noidea,noidea+n,testpoints);
    reverse(noidea,noidea+n);

    i=0;
    int temp;
    while(i<n)
    {

        temp = noidea[i].points;
        g=i;
        while(i<n && noidea[i].points == temp) i++;

        sort(noidea+g,noidea+i,testdifference);
        reverse(noidea+g,noidea+i);

    }

    i=0;
    team crap;
    while(i<n)
    {
        crap.points = noidea[i].points;
        crap.difference = noidea[i].difference;
        crap.scored = noidea[i].scored;
        g=i;

        while(i<n && crap.points == noidea[i].points && crap.difference == noidea[i].difference) i++;
        sort(noidea+g,noidea+i,testscores);
        reverse(noidea+g,noidea+i);

    }

    string winners[n/2];

    for(i=0;i<n/2;i++)
    {
        winners[i] = noidea[i].name;
    }

    sort(winners,winners+n/2);

    for(i=0;i<n/2;i++)
    {
        cout << winners[i] << endl;
    }

    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

struct team{

    string name;
    int scored;
    int missed;
    int points;
    int difference;

};

int makeint(string j)
{
    int k;
    stringstream ss;

    ss << j;
    ss >> k;
    return k;
}

bool testpoints(team lhs, team rhs) {return lhs.points < rhs.points;}
bool testdifference(team lhs, team rhs) {return lhs.difference < rhs.difference;}
bool testscores(team lhs, team rhs) {return lhs.scored < rhs.scored;}

int absolute(int x)
{
    if (x<0) x*=-1;
    return x;
}

int main()
{

    int n,i,k,g,sc1,sc2;
    string mena,skore,tm1,tm2,sk1,sk2;
    cin >> n;
    team noidea[n];

    for(i=0;i<n;i++)
    {
        cin >> noidea[i].name;
        noidea[i].points = 0;
        noidea[i].scored = 0;
        noidea[i].missed = 0;
    }

    for(i=0;i<(n*(n-1)/2);i++)
    {
        cin >> mena >> skore;
        g=0;
        tm1="";
        tm2="";
        while(mena.at(g)!='-')
        {
            tm1 = tm1 + mena.at(g);
            g++;
        }
        g++;
        while(g<mena.length())
        {
            tm2 = tm2 +  mena.at(g);
            g++;
        }
        sk1 = "";
        sk2 = "";
        g=0;
        while(skore.at(g) != ':')
        {
            sk1 = sk1 + skore.at(g);
            g++;
        }
        g++;
        while(g<skore.length())
        {
            sk2 = sk2 + skore.at(g);
            g++;
        }

        sc1 = makeint(sk1);
        sc2 = makeint(sk2);

        //cout << tm1 << " " << tm2 << " " << sc1 << " " << sc2 << endl;

        for(k=0;k<n;k++)
        {

            if(tm1 == noidea[k].name)
            {
                noidea[k].scored += sc1;
                noidea[k].missed += sc2;
                if(sc1>sc2) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

            if(tm2 == noidea[k].name)
            {
                noidea[k].scored += sc2;
                noidea[k].missed += sc1;

                if(sc2>sc1) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

        }

    }

    for(i=0;i<n;i++)
    {
        noidea[i].difference = -noidea[i].scored - noidea[i].missed;
    }

   /*for(i=0;i<n;i++)
    {
        cout << noidea[i].name << " " << noidea[i].points << " " << noidea[i].difference << " " << noidea[i].scored << endl;
    } */

    sort(noidea,noidea+n,testpoints);
    reverse(noidea,noidea+n);

    i=0;
    int temp;
    while(i<n)
    {

        temp = noidea[i].points;
        g=i;
        while(i<n && noidea[i].points == temp) i++;

        sort(noidea+g,noidea+i,testdifference);
        reverse(noidea+g,noidea+i);

    }

    i=0;
    team crap;
    while(i<n)
    {
        crap.points = noidea[i].points;
        crap.difference = noidea[i].difference;
        crap.scored = noidea[i].scored;
        g=i;

        while(i<n && crap.points == noidea[i].points && crap.difference == noidea[i].difference) i++;
        sort(noidea+g,noidea+i,testscores);
        //reverse(noidea+g,noidea+i);

    }

    string winners[n/2];

    for(i=0;i<n/2;i++)
    {
        winners[i] = noidea[i].name;
    }

    sort(winners,winners+n/2);

    for(i=0;i<n/2;i++)
    {
        cout << winners[i] << endl;
    }

    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

struct team{

    string name;
    int scored;
    int missed;
    int points;
    int difference;

};

int makeint(string j)
{
    int k;
    stringstream ss;

    ss << j;
    ss >> k;
    return k;
}

bool testpoints(team lhs, team rhs) {return lhs.points < rhs.points;}
bool testdifference(team lhs, team rhs) {return lhs.difference < rhs.difference;}
bool testscores(team lhs, team rhs) {return lhs.difference < rhs.difference;}

int absolute(int x)
{
    if (x<0) x*=-1;
    return x;
}

int main()
{

    int n,i,k,g,sc1,sc2;
    string mena,skore,tm1,tm2,sk1,sk2;
    cin >> n;
    team noidea[n];

    for(i=0;i<n;i++)
    {
        cin >> noidea[i].name;
        noidea[i].points = 0;
        noidea[i].scored = 0;
        noidea[i].missed = 0;
    }

    for(i=0;i<(n*(n-1)/2);i++)
    {
        cin >> mena >> skore;
        g=0;
        tm1="";
        tm2="";
        while(mena.at(g)!='-')
        {
            tm1 = tm1 + mena.at(g);
            g++;
        }
        g++;
        while(g<mena.length())
        {
            tm2 = tm2 +  mena.at(g);
            g++;
        }
        sk1 = "";
        sk2 = "";
        g=0;
        while(skore.at(g) != ':')
        {
            sk1 = sk1 + skore.at(g);
            g++;
        }
        g++;
        while(g<skore.length())
        {
            sk2 = sk2 + skore.at(g);
            g++;
        }

        sc1 = makeint(sk1);
        sc2 = makeint(sk2);

        //cout << tm1 << " " << tm2 << " " << sc1 << " " << sc2 << endl;

        for(k=0;k<n;k++)
        {

            if(tm1 == noidea[k].name)
            {
                noidea[k].scored += sc1;
                noidea[k].missed += sc2;
                if(sc1>sc2) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

            if(tm2 == noidea[k].name)
            {
                noidea[k].scored += sc2;
                noidea[k].missed += sc1;

                if(sc2>sc1) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

        }

    }

    for(i=0;i<n;i++)
    {
        noidea[i].difference = -noidea[i].scored - noidea[i].missed;
    }

   /*for(i=0;i<n;i++)
    {
        cout << noidea[i].name << " " << noidea[i].points << " " << noidea[i].difference << " " << noidea[i].scored << endl;
    } */

    sort(noidea,noidea+n,testpoints);
    reverse(noidea,noidea+n);

    i=0;
    int temp;
    while(i<n)
    {

        temp = noidea[i].points;
        g=i;
        while(i<n && noidea[i].points == temp) i++;

        sort(noidea+g,noidea+i,testdifference);
        reverse(noidea+g,noidea+i);

    }

    i=0;
    team crap;
    while(i<n)
    {
        crap.points = noidea[i].points;
        crap.difference = noidea[i].difference;
        crap.scored = noidea[i].scored;
        g=i;

        while(i<n && crap.points == noidea[i].points && crap.difference == noidea[i].difference) i++;
        sort(noidea+g,noidea+i,testscores);
        //reverse(noidea+g,noidea+i);

    }

    string winners[n/2];

    for(i=0;i<n/2;i++)
    {
        winners[i] = noidea[i].name;
    }

    sort(winners,winners+n/2);

    for(i=0;i<n/2;i++)
    {
        cout << winners[i] << endl;
    }

    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

struct team{

    string name;
    int scored;
    int missed;
    int points;
    int difference;

};

int makeint(string j)
{
    int k;
    stringstream ss;

    ss << j;
    ss >> k;
    return k;
}

bool testpoints(team lhs, team rhs) {return lhs.points < rhs.points;}
bool testdifference(team lhs, team rhs) {return lhs.difference < rhs.difference;}
bool testscores(team lhs, team rhs) {return lhs.difference > rhs.difference;}

int absolute(int x)
{
    if (x<0) x*=-1;
    return x;
}

int main()
{

    int n,i,k,g,sc1,sc2;
    string mena,skore,tm1,tm2,sk1,sk2;
    cin >> n;
    team noidea[n];

    for(i=0;i<n;i++)
    {
        cin >> noidea[i].name;
        noidea[i].points = 0;
        noidea[i].scored = 0;
        noidea[i].missed = 0;
    }

    for(i=0;i<(n*(n-1)/2);i++)
    {
        cin >> mena >> skore;
        g=0;
        tm1="";
        tm2="";
        while(mena.at(g)!='-')
        {
            tm1 = tm1 + mena.at(g);
            g++;
        }
        g++;
        while(g<mena.length())
        {
            tm2 = tm2 +  mena.at(g);
            g++;
        }
        sk1 = "";
        sk2 = "";
        g=0;
        while(skore.at(g) != ':')
        {
            sk1 = sk1 + skore.at(g);
            g++;
        }
        g++;
        while(g<skore.length())
        {
            sk2 = sk2 + skore.at(g);
            g++;
        }

        sc1 = makeint(sk1);
        sc2 = makeint(sk2);

        //cout << tm1 << " " << tm2 << " " << sc1 << " " << sc2 << endl;

        for(k=0;k<n;k++)
        {

            if(tm1 == noidea[k].name)
            {
                noidea[k].scored += sc1;
                noidea[k].missed += sc2;
                if(sc1>sc2) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

            if(tm2 == noidea[k].name)
            {
                noidea[k].scored += sc2;
                noidea[k].missed += sc1;

                if(sc2>sc1) noidea[k].points +=3;
                else if (sc2==sc1) noidea[k].points++;

            }

        }

    }

    for(i=0;i<n;i++)
    {
        noidea[i].difference = -noidea[i].scored - noidea[i].missed;
    }

   /* for(i=0;i<n;i++)
    {
        cout << noidea[i].name << " " << noidea[i].points << " " << noidea[i].difference << " " << noidea[i].scored << endl;
    }*/

    sort(noidea,noidea+n,testpoints);
    reverse(noidea,noidea+n);

    i=0;
    int temp;
    while(i<n)
    {

        temp = noidea[i].points;
        g=i;
        while(i<n && noidea[i].points == temp) i++;

        sort(noidea+g,noidea+i,testdifference);

    }

    i=0;
    team crap;
    while(i<n)
    {
        crap.points = noidea[i].points;
        crap.difference = noidea[i].difference;
        crap.scored = noidea[i].scored;
        g=i;

        while(i<n && crap.points == noidea[i].points && crap.difference == noidea[i].difference) i++;
        sort(noidea+g,noidea+i,testscores);

    }

    string winners[n/2];

    for(i=0;i<n/2;i++)
    {
        winners[i] = noidea[i].name;
    }

    sort(winners,winners+n/2);

    for(i=0;i<n/2;i++)
    {
        cout << winners[i] << endl;
    }

    return 0;
}


#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string>
//#include <conio.h>

using namespace std;

int n;
string a[51],sa[51];
int b[51],c[51],goal[51],miss[51];

int find(string str)
{
    for (int i=0;i<n;i++)
    if (str == a[i]) return i;
}
string getteam(string str,int i,int j)
{
       string s;
       for (int k = i; k <= j; k++)
       {
           s.insert(k-i,1,str[k]);
       }
       return s;
}
int main()
{
//    freopen("A.txt","r",stdin);
    string str;
    cin >> n;
    for (int i=0;i<n;i++)
    {
        cin >> str;
        a[i] = str;
        c[i] = i;
    }
    int nn = n*(n-1)/2;
    string team,t1,t2,sc;
    char s[100];
    int sc1,sc2,t11,t22;
    char ch;
    int j;
    cin.ignore();
    for (int i=0;i<nn;i++)
    {
        getline(cin,str);
        istringstream iss ( str,istringstream::in);
        iss >> team >> sc1 >> ch >> sc2;
        int k = 0;
        while (team.at(k) != '-') k++;
        t1 = getteam(team,0,k-1);
        t2 = getteam(team,k+1,team.length()-1);
        t11 = find(t1);
        t22 = find(t2);
        goal[t11] += sc1;
        miss[t11] += sc2;
        goal[t22] += sc2;
        miss[t22] += sc1;
        if (sc1 == sc2)
        {
                b[t11]++;
                b[t22]++;
        }
        else
        if (sc1 > sc2)
        {
                b[t11] += 3;
        }
        else
        {
             b[t22] += 3;
        }
    }
    for (int i=0;i<n-1;i++)
    for (int j=i+1;j<n;j++)
    if ((b[i] < b[j]) || (b[i] == b[j] && goal[i]-miss[i]<goal[j]-miss[j]) || (b[i] == b[j] && goal[i]-miss[i]==goal[j]-miss[j] && goal[i]<goal[j]))
    {
             swap(b[c[i]],b[c[j]]);
             swap(c[i],c[j]);
    }
    for (int i=0;i<n/2;i++)
    {
        sa[i] = a[c[i]];
    }
    sort(sa,sa+n/2);
    for (int i=0;i<n/2;i++)cout << sa[i] << endl;
//    getch();
    return 0;
}


#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string>
//#include <conio.h>

using namespace std;

int n;
string a[51],sa[51];
int b[51],c[51],goal[51],miss[51];

int find(string str)
{
    for (int i=0;i<n;i++)
    if (str == a[i]) return i;
}
string getteam(string str,int i,int j)
{
       string s;
       for (int k = i; k <= j; k++)
       {
           s.insert(k-i,1,str[k]);
       }
       return s;
}
int main()
{
//    freopen("A.txt","r",stdin);
    string str;
    cin >> n;
    for (int i=0;i<n;i++)
    {
        cin >> str;
        a[i] = str;
        c[i] = i;
    }
    int nn = n*(n-1)/2;
    string team,t1,t2,sc;
    char s[100];
    int sc1,sc2,t11,t22;
    char ch;
    int j;
    cin.ignore();
    for (int i=0;i<nn;i++)
    {
        getline(cin,str);
        istringstream iss ( str,istringstream::in);
        iss >> team >> sc1 >> ch >> sc2;
        int k = 0;
        while (team.at(k) != '-') k++;
        t1 = getteam(team,0,k-1);
        t2 = getteam(team,k+1,team.length()-1);
        t11 = find(t1);
        t22 = find(t2);
        goal[t11] += sc1;
        miss[t11] += sc2;
        goal[t22] += sc2;
        miss[t22] += sc1;
        if (sc1 == sc2)
        {
                b[t11]++;
                b[t22]++;
        }
        else
        if (sc1 > sc2)
        {
                b[t11] += 3;
        }
        else
        {
             b[t22] += 3;
        }
    }
    for (int i=0;i<n-1;i++)
    for (int j=i+1;j<n;j++)
    if ((b[i] < b[j]) || (b[i] == b[j] && goal[i]-miss[i]<goal[j]-miss[j]) || (b[i] == b[j] && goal[i]-miss[i]<goal[j]-miss[j] && goal[i]<goal[j]))
    {
             swap(b[i],b[j]);
             swap(c[i],c[j]);
    }
    for (int i=0;i<n/2;i++)
    {
        sa[i] = a[c[i]];
    }
    sort(sa,sa+n/2);
    for (int i=0;i<n/2;i++)cout << sa[i] << endl;
//    getch();
    return 0;
}


#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string>
//#include <conio.h>

using namespace std;

int n;
string a[51],sa[51];
int b[51],c[51],goal[51],miss[51];

int find(string str)
{
    for (int i=0;i<n;i++)
    if (str == a[i]) return i;
}
string getteam(string str,int i,int j)
{
       string s;
       for (int k = i; k <= j; k++)
       {
           s.insert(k-i,1,str[k]);
       }
       return s;
}
int main()
{
//    freopen("A.txt","r",stdin);
    string str;
    cin >> n;
    for (int i=0;i<n;i++)
    {
        cin >> str;
        a[i] = str;
        c[i] = i;
    }
    if (n == 1)
    {
          cout << a[0];
          return 0;
    }
    int nn = n*(n-1)/2;
    string team,t1,t2,sc;
    int sc1,sc2,t11,t22;
    char ch;
    cin.ignore();
    for (int i=0;i<nn;i++)
    {
        getline(cin,str);
        istringstream iss ( str,istringstream::in);
        iss >> team >> sc1 >> ch >> sc2;
        int k = 0;
        while (team.at(k) != '-') k++;
        t1 = getteam(team,0,k-1);
        t2 = getteam(team,k+1,team.length()-1);
        t11 = find(t1);
        t22 = find(t2);
        goal[t11] += sc1;
        miss[t11] += sc2;
        goal[t22] += sc2;
        miss[t22] += sc1;
        if (sc1 == sc2)
        {
                b[t11]++;
                b[t22]++;
        }
        else
        if (sc1 > sc2)
        {
                b[t11] += 3;
        }
        else
        {
             b[t22] += 3;
        }
    }
    for (int i=0;i<n-1;i++)
    for (int j=i+1;j<n;j++)
    if ((b[c[i]] < b[c[j]]) || (b[c[i]] == b[c[j]] && goal[c[i]]-miss[c[i]]<goal[c[j]]-miss[c[j]]) || (b[c[i]] == b[c[j]] && goal[c[i]]-miss[c[i]]==goal[c[j]]-miss[c[j]] && goal[c[i]]<goal[c[j]]))
    {
             swap(b[c[i]],b[c[j]]);
             swap(c[i],c[j]);
    }
    for (int i=0;i<n/2;i++)
    {
        sa[i] = a[c[i]];
    }
    for (int i=0;i<n/2-1;i++)
    for (int j=i+1;j<n/2;j++)
    if (sa[i]>sa[j]) swap(sa[i],sa[j]);
    for (int i=0;i<n/2;i++)cout << sa[i] << endl;
//    getch();
    return 0;
}


#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string>
//#include <conio.h>

using namespace std;

int n;
string a[51],sa[51];
int b[51],c[51];

int find(string str)
{
    for (int i=0;i<n;i++)
    if (str == a[i]) return i;
}
string getteam(string str,int i,int j)
{
       string s;
       for (int k = i; k <= j; k++)
       {
           s.insert(k-i,1,str[k]);
       }
       return s;
}
int main()
{
//    freopen("A.txt","r",stdin);
    string str;
    cin >> n;
    for (int i=0;i<n;i++)
    {
        cin >> str;
        a[i] = str;
        c[i] = i;
    }
    int nn = n*(n-1)/2;
    string team,t1,t2,sc;
    char s[100];
    int sc1,sc2;
    char ch;
    int j;
    cin.ignore();
    for (int i=0;i<nn;i++)
    {
        getline(cin,str);
        istringstream iss ( str,istringstream::in);
        iss >> team >> sc1 >> ch >> sc2;
        int k = 0;
        while (team.at(k) != '-') k++;
        t1 = getteam(team,0,k-1);
        t2 = getteam(team,k+1,team.length()-1);
        if (sc1 == sc2)
        {
                j = find(t1);
                b[j]++;
                j = find(t2);
                b[j]++;
        }
        else
        if (sc1 > sc2)
        {
                j = find(t1);
                b[j] += 3;
        }
        else
        {
             j = find(t2);
             b[j] += 3;
        }
    }
    for (int i=0;i<n-1;i++)
    for (int j=i+1;j<n;j++)
    if (b[i] < b[j])
    {
             swap(b[i],b[j]);
             swap(c[i],c[j]);
    }
    for (int i=0;i<n/2;i++)
    {
        sa[i] = a[c[i]];
    }
    sort(sa,sa+n/2);
    for (int i=0;i<n/2;i++)cout << sa[i] << endl;
//    getch();
    return 0;
}


#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string>
//#include <conio.h>

using namespace std;

int n;
string a[51],sa[51];
int b[51],c[51],goal[51],miss[51];

int find(string str)
{
    for (int i=0;i<n;i++)
    if (str == a[i]) return i;
}
string getteam(string str,int i,int j)
{
       string s;
       for (int k = i; k <= j; k++)
       {
           s.insert(k-i,1,str[k]);
       }
       return s;
}
int main()
{
//    freopen("A.txt","r",stdin);
    string str;
    cin >> n;
    for (int i=0;i<n;i++)
    {
        cin >> str;
        a[i] = str;
        c[i] = i;
    }
    int nn = n*(n-1)/2;
    string team,t1,t2,sc;
    char s[100];
    int sc1,sc2,t11,t22;
    char ch;
    int j;
    cin.ignore();
    for (int i=0;i<nn;i++)
    {
        getline(cin,str);
        istringstream iss ( str,istringstream::in);
        iss >> team >> sc1 >> ch >> sc2;
        int k = 0;
        while (team.at(k) != '-') k++;
        t1 = getteam(team,0,k-1);
        t2 = getteam(team,k+1,team.length()-1);
        t11 = find(t1);
        t22 = find(t2);
        goal[t11] += sc1;
        miss[t11] += sc2;
        goal[t22] += sc2;
        miss[t22] += sc1;
        if (sc1 == sc2)
        {
                b[t11]++;
                b[t22]++;
        }
        else
        if (sc1 > sc2)
        {
                b[t11] += 3;
        }
        else
        {
             b[t22] += 3;
        }
    }
    for (int i=0;i<n-1;i++)
    for (int j=i+1;j<n;j++)
    if ((b[i] < b[j]) || (b[i] == b[j] && goal[i]-miss[i]<goal[j]-miss[j]) || (b[i] == b[j] && goal[i]-miss[i]==goal[j]-miss[j] && goal[i]<goal[j]))
    {
             swap(b[i],b[j]);
             swap(c[i],c[j]);
    }
    for (int i=0;i<n/2;i++)
    {
        sa[i] = a[c[i]];
    }
    sort(sa,sa+n/2);
    for (int i=0;i<n/2;i++)cout << sa[i] << endl;
//    getch();
    return 0;
}


#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string>
//#include <conio.h>

using namespace std;

int n;
string a[51],sa[51];
int b[51],c[51],goal[51],miss[51];

int find(string str)
{
    for (int i=0;i<n;i++)
    if (str == a[i]) return i;
}
string getteam(string str,int i,int j)
{
       string s;
       for (int k = i; k <= j; k++)
       {
           s.insert(k-i,1,str[k]);
       }
       return s;
}
int main()
{
//    freopen("A.txt","r",stdin);
    string str;
    cin >> n;
    for (int i=0;i<n;i++)
    {
        cin >> str;
        a[i] = str;
        c[i] = i;
    }
    int nn = n*(n-1)/2;
    string team,t1,t2,sc;
    char s[100];
    int sc1,sc2,t11,t22;
    char ch;
    int j;
    cin.ignore();
    for (int i=0;i<nn;i++)
    {
        getline(cin,str);
        istringstream iss ( str,istringstream::in);
        iss >> team >> sc1 >> ch >> sc2;
        int k = 0;
        while (team.at(k) != '-') k++;
        t1 = getteam(team,0,k-1);
        t2 = getteam(team,k+1,team.length()-1);
        t11 = find(t1);
        t22 = find(t2);
        goal[t11] += sc1;
        miss[t11] += sc2;
        goal[t22] += sc2;
        miss[t22] += sc1;
        if (sc1 == sc2)
        {
                b[t11]++;
                b[t22]++;
        }
        else
        if (sc1 > sc2)
        {
                b[t11] += 3;
        }
        else
        {
             b[t22] += 3;
        }
    }
    for (int i=0;i<n-1;i++)
    for (int j=i+1;j<n;j++)
    if ((b[c[i]] < b[c[j]]) || (b[c[i]] == b[c[j]] && goal[c[i]]-miss[c[i]]<goal[c[j]]-miss[c[j]]) || (b[c[i]] == b[c[j]] && goal[c[i]]-miss[c[i]]==goal[c[j]]-miss[c[j]] && goal[c[i]]<goal[c[j]]))
    {
             swap(b[c[i]],b[c[j]]);
             swap(c[i],c[j]);
    }
    for (int i=0;i<n/2;i++)
    {
        sa[i] = a[c[i]];
    }
    sort(sa,sa+n/2);
    for (int i=0;i<n/2;i++)cout << sa[i] << endl;
//    getch();
    return 0;
}


#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string>
//#include <conio.h>

using namespace std;

int n;
string a[51],sa[51];
int b[51],c[51],goal[51],miss[51];

int find(string str)
{
    for (int i=0;i<n;i++)
    if (str == a[i]) return i;
}
string getteam(string str,int i,int j)
{
       string s;
       for (int k = i; k <= j; k++)
       {
           s.insert(k-i,1,str[k]);
       }
       return s;
}
int main()
{
//    freopen("A.txt","r",stdin);
    string str;
    cin >> n;
    for (int i=0;i<n;i++)
    {
        cin >> str;
        a[i] = str;
        c[i] = i;
    }
    if (n == 1)
    {
          cout << a[0];
          return 0;
    }
    int nn = n*(n-1)/2;
    string team,t1,t2,sc;
    int sc1,sc2,t11,t22;
    char ch;
    cin.ignore();
    for (int i=0;i<nn;i++)
    {
        getline(cin,str);
        istringstream iss ( str,istringstream::in);
        iss >> team >> sc1 >> ch >> sc2;
        int k = 0;
        while (team.at(k) != '-') k++;
        t1 = getteam(team,0,k-1);
        t2 = getteam(team,k+1,team.length()-1);
        t11 = find(t1);
        t22 = find(t2);
        goal[t11] += sc1;
        miss[t11] += sc2;
        goal[t22] += sc2;
        miss[t22] += sc1;
        if (sc1 == sc2)
        {
                b[t11]++;
                b[t22]++;
        }
        else
        if (sc1 > sc2)
        {
                b[t11] += 3;
        }
        else
        {
             b[t22] += 3;
        }
    }
    for (int i=0;i<n-1;i++)
    for (int j=i+1;j<n;j++)
    if ((b[c[i]] < b[c[j]]) || (b[c[i]] == b[c[j]] && goal[c[i]]-miss[c[i]]>goal[c[j]]-miss[c[j]]) || (b[c[i]] == b[c[j]] && goal[c[i]]-miss[c[i]]==goal[c[j]]-miss[c[j]] && goal[c[i]]<goal[c[j]]))
    {
             swap(b[c[i]],b[c[j]]);
             swap(c[i],c[j]);
    }
    for (int i=0;i<n/2;i++)
    {
        sa[i] = a[c[i]];
    }
    for (int i=0;i<n/2-1;i++)
    for (int j=i+1;j<n/2;j++)
    if (sa[i]>sa[j]) swap(sa[i],sa[j]);
    for (int i=0;i<n/2;i++)cout << sa[i] << endl;
//    getch();
    return 0;
}


#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string>
//#include <conio.h>

using namespace std;

int n;
string a[51],sa[51];
int b[51],c[51],goal[51],miss[51];

int find(string str)
{
    for (int i=0;i<n;i++)
    if (str == a[i]) return i;
}
string getteam(string str,int i,int j)
{
       string s;
       for (int k = i; k <= j; k++)
       {
           s.insert(k-i,1,str[k]);
       }
       return s;
}
int main()
{
//    freopen("A.txt","r",stdin);
    string str;
    cin >> n;
    for (int i=0;i<n;i++)
    {
        cin >> str;
        a[i] = str;
        c[i] = i;
    }
    if (n == 1)
    {
          cout << a[0];
          return 0;
    }
    int nn = n*(n-1)/2;
    string team,t1,t2,sc;
    int sc1,sc2,t11,t22;
    char ch;
    cin.ignore();
    for (int i=0;i<nn;i++)
    {
        getline(cin,str);
        istringstream iss ( str,istringstream::in);
        iss >> team >> sc1 >> ch >> sc2;
        int k = 0;
        while (team.at(k) != '-') k++;
        t1 = getteam(team,0,k-1);
        t2 = getteam(team,k+1,team.length()-1);
        t11 = find(t1);
        t22 = find(t2);
        goal[t11] += sc1;
        miss[t11] += sc2;
        goal[t22] += sc2;
        miss[t22] += sc1;
        if (sc1 == sc2)
        {
                b[t11]++;
                b[t22]++;
        }
        else
        if (sc1 > sc2)
        {
                b[t11] += 3;
        }
        else
        {
             b[t22] += 3;
        }
    }
    for (int i=0;i<n-1;i++)
    for (int j=i+1;j<n;j++)
    if ((b[c[i]] < b[c[j]]) || (b[c[i]] == b[c[j]] && goal[c[i]]-miss[c[i]]<goal[c[j]]-miss[c[j]]) || (b[c[i]] == b[c[j]] && goal[c[i]]-miss[c[i]]==goal[c[j]]-miss[c[j]] && goal[c[i]]<goal[c[j]]))
    {
             swap(c[i],c[j]);
    }
    for (int i=0;i<n/2;i++)
    {
        sa[i] = a[c[i]];
    }
    for (int i=0;i<n/2-1;i++)
    for (int j=i+1;j<n/2;j++)
    if (sa[i]>sa[j]) swap(sa[i],sa[j]);
    for (int i=0;i<n/2;i++)cout << sa[i] << endl;
//    getch();
    return 0;
}


#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string>
//#include <conio.h>

using namespace std;

int n;
string a[51],sa[51];
int b[51],c[51],goal[51],miss[51];

int find(string str)
{
    for (int i=0;i<n;i++)
    if (str == a[i]) return i;
}
string getteam(string str,int i,int j)
{
       string s;
       for (int k = i; k <= j; k++)
       {
           s.insert(k-i,1,str[k]);
       }
       return s;
}
int main()
{
//    freopen("A.txt","r",stdin);
    string str;
    cin >> n;
    for (int i=0;i<n;i++)
    {
        cin >> str;
        a[i] = str;
        c[i] = i;
    }
    int nn = n*(n-1)/2;
    string team,t1,t2,sc;
    int sc1,sc2,t11,t22;
    char ch;
    cin.ignore();
    for (int i=0;i<nn;i++)
    {
        getline(cin,str);
        istringstream iss ( str,istringstream::in);
        iss >> team >> sc1 >> ch >> sc2;
        int k = 0;
        while (team.at(k) != '-') k++;
        t1 = getteam(team,0,k-1);
        t2 = getteam(team,k+1,team.length()-1);
        t11 = find(t1);
        t22 = find(t2);
        goal[t11] += sc1;
        miss[t11] += sc2;
        goal[t22] += sc2;
        miss[t22] += sc1;
        if (sc1 == sc2)
        {
                b[t11]++;
                b[t22]++;
        }
        else
        if (sc1 > sc2)
        {
                b[t11] += 3;
        }
        else
        {
             b[t22] += 3;
        }
    }
    for (int i=0;i<n-1;i++)
    for (int j=i+1;j<n;j++)
    if ((b[c[i]] < b[c[j]]) || (b[c[i]] == b[c[j]] && goal[c[i]]-miss[c[i]]<goal[c[j]]-miss[c[j]]) || (b[c[i]] == b[c[j]] && goal[c[i]]-miss[c[i]]==goal[c[j]]-miss[c[j]] && goal[c[i]]<goal[c[j]]))
    {
             swap(b[c[i]],b[c[j]]);
             swap(c[i],c[j]);
    }
    for (int i=0;i<n/2;i++)
    {
        sa[i] = a[c[i]];
    }
    for (int i=0;i<n/2-1;i++)
    for (int j=i+1;j<n/2;j++)
    if (sa[i]>sa[j]) swap(sa[i],sa[j]);
    for (int i=0;i<n/2;i++)cout << sa[i] << endl;
//    getch();
    return 0;
}


#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int n,m,len;
struct node
{
	char c[40];
	int x;
	int y;
	int f;
}arr[55];
int find(char tmp[])
{
	int i;
	for(i=0;i<n;i++)
		if(strcmp(tmp,arr[i].c)==0)  return i;
	return 100;
}
void add(int t1,int t2,int x1,int x2)
{
	if(x1>x2)  {arr[t1].f+=3;arr[t2].f+=0;}
	if(x1==x2) {arr[t1].f+=1;arr[t2].f+=1;}
	if(x2>x1)  {arr[t2].f+=3;arr[t1].f+=0;}
	arr[t1].x+=x1;
	arr[t1].y+=x2;
	arr[t2].x+=x2;
	arr[t2].y+=x1;
}

bool cmp(node a,node b)
{
	if(a.f!=b.f)  return a.f>b.f;
	if((a.x-a.y)!=(b.x-b.y))  return a.x-a.y>b.x-b.y;
	return a.x>b.x;
}

bool cm(node a,node b)
{
	if(strcmp(a.c,b.c)<0)  return 1;
	return 0;
}

int main()
{
	int i,j,x1,x2,t1,t2;
	char tmp[40];
	while(scanf("%d",&n)!=EOF)
	{
		memset(arr,0,sizeof(arr));
		for(i=0;i<n;i++)
			scanf("%s",&arr[i].c);
		for(i=0;i<n*(n-1)/2;i++)
		{
			scanf("%s %d:%d",&tmp,&x1,&x2);
			for(j=0;j<strlen(tmp);j++)
				if(tmp[j]=='-') break;
			tmp[j]=0;
			t1=find(tmp);
			t2=find(tmp+j+1);
			add(t1,t2,x1,x2);
		}
		sort(arr,arr+n,cmp);
		sort(arr,arr+n/2,cm);
		for(i=0;i<n/2;i++)
			printf("%s\n",arr[i].c);
	}
	return 0;
}


#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int n,m,len;
struct node
{
	char c[40];
	int x;
	int y;
	int f;
}arr[55];
int find(char tmp[])
{
	int i;
	for(i=0;i<n;i++)
		if(strcmp(tmp,arr[i].c)==0)  return i;
	return 100;
}
void add(int t1,int t2,int x1,int x2)
{
	if(x1>x2)  {arr[t1].f+=3;arr[t2].f+=0;}
	if(x1==x2) {arr[t1].f+=1;arr[t2].f+=1;}
	if(x2>x1)  {arr[t2].f+=3;arr[t1].f+=0;}
	arr[t1].x=x1;
	arr[t1].y=x2;
	arr[t2].x=x2;
	arr[t2].y=x1;
}

bool cmp(node a,node b)
{
	if(a.f!=b.f)  return a.f>b.f;
	if((a.x-a.y)!=(b.x-a.y))  return a.x-a.y>b.x-b.y;
	return a.x>b.x;
}

bool cm(node a,node b)
{
	if(strcmp(a.c,b.c)<0)  return 1;
	return 0;
}

int main()
{
	int i,j,x1,x2,t1,t2;
	char tmp[40];
	while(scanf("%d",&n)!=EOF)
	{
		memset(arr,0,sizeof(arr));
		for(i=0;i<n;i++)
			scanf("%s",&arr[i].c);
		for(i=0;i<n*(n-1)/2;i++)
		{
			scanf("%s %d:%d",&tmp,&x1,&x2);
			for(j=0;j<strlen(tmp);j++)
				if(tmp[j]=='-') break;
			tmp[j]=0;
			t1=find(tmp);
			t2=find(tmp+j+1);
			add(t1,t2,x1,x2);
		}
		sort(arr,arr+n,cmp);
		sort(arr,arr+n/2,cm);
		for(i=0;i<n/2;i++)
			printf("%s\n",arr[i].c);
	}
	return 0;
}


#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int n,m,len;
struct node
{
	char c[40];
	int x;
	int y;
	int f;
}arr[55];
int find(char tmp[])
{
	int i;
	for(i=0;i<n;i++)
		if(strcmp(tmp,arr[i].c)==0)  return i;
	return 100;
}
void add(int t1,int t2,int x1,int x2)
{
	if(x1>x2)  {arr[t1].f+=3;arr[t2].f+=0;}
	if(x1==x2) {arr[t1].f+=1;arr[t2].f+=1;}
	if(x2>x1)  {arr[t2].f+=3;arr[t1].f+=0;}
	arr[t1].x+=x1;
	arr[t1].y+=x2;
	arr[t2].x+=x2;
	arr[t2].y+=x1;
}

bool cmp(node a,node b)
{
	if(a.f!=b.f)  return a.f>b.f;
	if((a.x-a.y)!=(b.x-b.y))  return (a.x-a.y)>(b.x-b.y);
	return a.x>b.x;
}

bool cm(node a,node b)
{
	if(strcmp(a.c,b.c)==-1)  return 1;
	return 0;
}

int main()
{
	int i,j,x1,x2,t1,t2;
	char tmp[40];
	while(scanf("%d",&n)!=EOF)
	{
		memset(arr,0,sizeof(arr));
		for(i=0;i<n;i++)
			scanf("%s",&arr[i].c);
		for(i=0;i<n*(n-1)/2;i++)
		{
			scanf("%s%d:%d",&tmp,&x1,&x2);
			for(j=0;j<strlen(tmp);j++)
				if(tmp[j]=='-') break;
			tmp[j]=0;
			t1=find(tmp);
			t2=find(tmp+j+1);
			add(t1,t2,x1,x2);
		}
		sort(arr,arr+n,cmp);
		sort(arr,arr+n/2,cm);
		for(i=0;i<n/2;i++)
			printf("%s\n",arr[i].c);
	}
	return 0;
}


#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int n,m,len;
struct node
{
	char c[40];
	int x;
	int y;
	int f;
}arr[55];
int find(char tmp[])
{
	int i;
	for(i=0;i<n;i++)
		if(strcmp(tmp,arr[i].c)==0)  return i;
	return 100;
}
void add(int t1,int t2,int x1,int x2)
{
	if(x1>x2)  {arr[t1].f+=3;arr[t2].f+=0;}
	if(x1==x2) {arr[t1].f+=1;arr[t2].f+=1;}
	if(x2>x1)  {arr[t2].f+=3;arr[t1].f+=0;}
	arr[t1].x+=x1;
	arr[t1].y+=x2;
	arr[t2].x+=x2;
	arr[t2].y+=x1;
}

bool cmp(node a,node b)
{
	if(a.f!=b.f)  return a.f>b.f;
	if((a.x-a.y)!=(b.x-b.y))  return (a.x-a.y)>(b.x-b.y);
	return a.x>b.x;
}

bool cm(node a,node b)
{
	if(strcmp(a.c,b.c)==-1)  return 1;
	return 0;
}

int main()
{
	int i,j,x1,x2,t1,t2;
	char tmp[80];
	while(scanf("%d",&n)!=EOF)
	{
		memset(arr,0,sizeof(arr));
		for(i=0;i<n;i++)
			scanf("%s",&arr[i].c);
		for(i=0;i<n*(n-1)/2;i++)
		{
			scanf("%s%d:%d",&tmp,&x1,&x2);
			for(j=0;j<strlen(tmp);j++)
				if(tmp[j]=='-') break;
			tmp[j]=0;
			t1=find(tmp);
			t2=find(tmp+j+1);
			add(t1,t2,x1,x2);
		}
		sort(arr,arr+n,cmp);
		sort(arr,arr+n/2,cm);
		for(i=0;i<n/2;i++)
			printf("%s\n",arr[i].c);
	}
	return 0;
}


#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int n,m,len;
struct node
{
	char c[40];
	int x;
	int y;
	int f;
}arr[55];
int find(char tmp[])
{
	int i;
	for(i=0;i<n;i++)
		if(strcmp(tmp,arr[i].c)==0)  return i;
	return 100;
}
void add(int t1,int t2,int x1,int x2)
{
	if(x1>x2)  {arr[t1].f+=3;arr[t2].f+=0;}
	if(x1==x2) {arr[t1].f+=1;arr[t2].f+=1;}
	if(x2>x1)  {arr[t2].f+=3;arr[t1].f+=0;}
	arr[t1].x+=x1;
	arr[t1].y+=x2;
	arr[t2].x+=x2;
	arr[t2].y+=x1;
}

bool cmp(node a,node b)
{
	if(a.f!=b.f)  return a.f>b.f;
	if((a.x-a.y)!=(b.x-b.y))  return (a.x-a.y)>(b.x-b.y);
	return a.x>b.x;
}

bool cm(node a,node b)
{
	int i;
	char c1[40],c2[40];
	strcpy(c1,a.c);
	strcpy(c2,b.c);
	for(i=0;i<strlen(c1);i++)
		if(c1[i]>='A'&&c1[i]<='Z')  c1[i]=c1[i]-'A'+'a';
	for(i=0;i<strlen(c2);i++)
		if(c2[i]>='A'&&c2[i]<='Z')  c2[i]=c2[i]-'A'+'a';
	if(strcmp(c1,c2)==-1)  return 1;
	return 0;
}

int main()
{
	int i,j,x1,x2,t1,t2;
	char tmp[40];
	while(scanf("%d",&n)!=EOF)
	{
		memset(arr,0,sizeof(arr));
		for(i=0;i<n;i++)
			scanf("%s",&arr[i].c);
		for(i=0;i<n*(n-1)/2;i++)
		{
			scanf("%s%d:%d",&tmp,&x1,&x2);
			for(j=0;j<strlen(tmp);j++)
				if(tmp[j]=='-') break;
			tmp[j]=0;
			t1=find(tmp);
			t2=find(tmp+j+1);
			add(t1,t2,x1,x2);
		}
		sort(arr,arr+n,cmp);
		sort(arr,arr+n/2,cm);
		for(i=0;i<n/2;i++)
			printf("%s\n",arr[i].c);
	}
	return 0;
}


#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int n,m,len;
struct node
{
	char c[40];
	int x;
	int y;
	int f;
}arr[55];
int find(char tmp[])
{
	int i;
	for(i=0;i<n;i++)
		if(strcmp(tmp,arr[i].c)==0)  return i;
	return 100;
}
void add(int t1,int t2,int x1,int x2)
{
	if(x1>x2)  {arr[t1].f+=3;arr[t2].f+=0;}
	if(x1==x2) {arr[t1].f+=1;arr[t2].f+=1;}
	if(x2>x1)  {arr[t2].f+=3;arr[t1].f+=0;}
	arr[t1].x=x1;
	arr[t1].y=x2;
	arr[t2].x=x2;
	arr[t2].y=x1;
}

bool cmp(node a,node b)
{
	if(a.f!=b.f)  return a.f>b.f;
	if(a.x-a.y!=b.x-a.y)  return a.x-a.y>b.x-a.y;
	return a.x>b.x;
}

bool cm(node a,node b)
{
	if(strcmp(a.c,b.c)<0)  return 1;
	return 0;
}

int main()
{
	int i,j,x1,x2,t1,t2;
	char tmp[40];
	while(scanf("%d",&n)!=EOF)
	{
		memset(arr,0,sizeof(arr));
		for(i=0;i<n;i++)
			scanf("%s",&arr[i].c);
		for(i=0;i<n*(n-1)/2;i++)
		{
			scanf("%s%d:%d",&tmp,&x1,&x2);
			for(j=0;j<strlen(tmp);j++)
				if(tmp[j]=='-') break;
			tmp[j]=0;
			t1=find(tmp);
			t2=find(tmp+j+1);
			add(t1,t2,x1,x2);
		}
		sort(arr,arr+n,cmp);
		sort(arr,arr+n/2,cm);
		for(i=0;i<n/2;i++)
			printf("%s\n",arr[i].c);
	}
	return 0;
}


#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int n,m,len;
struct node
{
	char c[40];
	int x;
	int y;
	int f;
}arr[55];
int find(char tmp[])
{
	int i;
	for(i=0;i<n;i++)
		if(strcmp(tmp,arr[i].c)==0)  return i;
	return 100;
}
void add(int t1,int t2,int x1,int x2)
{
	if(x1>x2)  {arr[t1].f+=3;arr[t2].f+=0;}
	if(x1==x2) {arr[t1].f+=1;arr[t2].f+=1;}
	if(x2>x1)  {arr[t2].f+=3;arr[t1].f+=0;}
	arr[t1].x=x1;
	arr[t1].y=x2;
	arr[t2].x=x2;
	arr[t2].y=x1;
}

bool cmp(node a,node b)
{
	if(a.f!=b.f)  return a.f>b.f;
	if(a.x-a.y!=b.x-a.y)  return a.x-a.y>b.x-a.y;
	return a.x>b.x;
}

bool cm(node a,node b)
{
	if(strcmp(a.c,b.c)<0)  return 1;
	return 0;
}

int main()
{
	int i,j,x1,x2,t1,t2;
	char tmp[40];
	while(scanf("%d",&n)!=EOF)
	{
		memset(arr,0,sizeof(arr));
		for(i=0;i<n;i++)
			scanf("%s",&arr[i].c);
		for(i=0;i<n*(n-1)/2;i++)
		{
			scanf("%s%d:%d",&tmp,&x1,&x2);
			for(j=0;j<strlen(tmp);j++)
				if(tmp[j]=='-') break;
			tmp[j]=0;
			t1=find(tmp);
			t2=find(tmp+j+1);
			add(t1,t2,x1,x2);
		}
		sort(arr,arr+n,cmp);
		sort(arr,arr+n/2,cm);
		for(i=0;i<n/2;i++)
			printf("%s\n",arr[i].c);
	}
	return 1;
}


#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int n,m,len;
struct node
{
	char c[40];
	int x;
	int y;
	int f;
}arr[55];
int find(char tmp[])
{
	int i;
	for(i=0;i<n;i++)
		if(strcmp(tmp,arr[i].c)==0)  return i;
	return 100;
}
void add(int t1,int t2,int x1,int x2)
{
	if(x1>x2)  {arr[t1].f+=3;arr[t2].f+=0;}
	if(x1==x2) {arr[t1].f+=1;arr[t2].f+=1;}
	if(x2>x1)  {arr[t2].f+=3;arr[t1].f+=0;}
	arr[t1].x=x1;
	arr[t1].y=x2;
	arr[t2].x=x2;
	arr[t2].y=x1;
}

bool cmp(node a,node b)
{
	if(a.f!=b.f)  return a.f>b.f;
	if((a.x-a.y)!=(b.x-b.y))  return a.x-a.y>b.x-b.y;
	return a.x>b.x;
}

bool cm(node a,node b)
{
	if(strcmp(a.c,b.c)<0)  return 1;
	return 0;
}

int main()
{
	int i,j,x1,x2,t1,t2;
	char tmp[40];
	while(scanf("%d",&n)!=EOF)
	{
		memset(arr,0,sizeof(arr));
		for(i=0;i<n;i++)
			scanf("%s",&arr[i].c);
		for(i=0;i<n*(n-1)/2;i++)
		{
			scanf("%s %d:%d",&tmp,&x1,&x2);
			for(j=0;j<strlen(tmp);j++)
				if(tmp[j]=='-') break;
			tmp[j]=0;
			t1=find(tmp);
			t2=find(tmp+j+1);
			add(t1,t2,x1,x2);
		}
		sort(arr,arr+n,cmp);
		sort(arr,arr+n/2,cm);
		for(i=0;i<n/2;i++)
			printf("%s\n",arr[i].c);
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
struct node
{
    string name;
    int point,sum;
}so[51];
bool cmp(node a,node b)
{
    if(a.point==b.point)return a.sum>b.sum;
    else
    return a.point>b.point;
}
bool cmp2(node a,node b)
{
    //for(int i=0;i<a.name.size();i++)if(a.name[i]>='A'&&a.name[i]<='Z')a.name[i]+=32;
    //for(int i=0;i<b.name.size();i++)if(b.name[i]>='A'&&b.name[i]<='Z')b.name[i]+=32;
    //if(a.name.size()==b.name.size())
    return a.name<b.name;
    //else
    //return a.name.size()<b.name.size();
}
int n,b1,b2;
string nm[51];
char c;
map<string,int> f,kin;
string a,m1,m2;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a;
        //scanf("%s",a);
        nm[i]=a;
        kin[a]=0;
        f[a]=0;
        //f.insert(make_pair(a,0));
    }

    for(int i=1;i<=n*(n-1)/2;i++)
    {//cin.ignore();
        m1="";m2="";b1=0;b2=0;
        while(1)
        {
            scanf("%c",&c);
            //cout<<c<<" ";
            if(c=='\n')continue;
            if(c=='-')break;
            else
            if((c>='A'&&c<='Z')||(c>='a'&&c<='z'))m1+=c;
        }
        while(1)
        {
            scanf("%c",&c);
            if(c==' ')break;
            else
            m2+=c;
        }
        while(1)
        {
            scanf("%c",&c);
            if(c==':')break;
            else
            b1*=10,b1+=c-'0';
        }
        cin>>b2;
        kin[m1]+=b1;kin[m2]+=b2;
        //scanf("%s-%s %d:%d",&m1,&m2,&b1,&b2);
        //cout<<m1<<" "<<b1<<" "<<m2<<" "<<b2<<endl;
        if(b1>b2)f[m1]+=3;
        ///cout<<f[3];
        //cout<<m1<<" "<<"a";
        //m1="a";
        //if(m1=="a")cout<<1;
        if(b1==b2)f[m1]++,f[m2]++;
        if(b1<b2)f[m2]+=3;
    }
    for(int i=1;i<=n;i++)
    {
        so[i].name=nm[i];
        so[i].point=f[nm[i]];
        so[i].sum=kin[nm[i]];
        //cout<<nm[i]<<" "<<f[nm[i]]<<endl;
    }
    sort(so+1,so+n+1,cmp);
    sort(so+1,so+n/2+1,cmp2);
    for(int i=1;i<=n/2;i++)
    {
        cout<<so[i].name<<endl;
        //cout<<so[i].point<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
struct node
{
    string name;
    int point;
}so[51];
bool cmp(node a,node b)
{
    if(a.point==b.point)return a.name<b.name;
    else
    return a.point>b.point;
}
bool cmp2(node a,node b)
{
    return a.name<b.name;
}
int n,b1,b2;
string nm[51];
char c;
map<string,int> f;
string a,m1,m2;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a;
        //scanf("%s",a);
        nm[i]=a;
        f[a]=0;
        //f.insert(make_pair(a,0));
    }

    for(int i=1;i<=n*(n-1)/2;i++)
    {//cin.ignore();
        m1="";m2="";b1=0;b2=0;
        while(1)
        {
            scanf("%c",&c);
            //cout<<c<<" ";
            if(c=='\n')continue;
            if(c=='-')break;
            else
            if((c>='A'&&c<='Z')||(c>='a'&&c<='z'))m1+=c;
        }
        while(1)
        {
            scanf("%c",&c);
            if(c==' ')break;
            else
            m2+=c;
        }
        while(1)
        {
            scanf("%c",&c);
            if(c==':')break;
            else
            b1*=10,b1+=c-'0';
        }
        cin>>b2;
        //scanf("%s-%s %d:%d",&m1,&m2,&b1,&b2);
        //cout<<m1<<" "<<b1<<" "<<m2<<" "<<b2<<endl;
        if(b1>b2)f[m1]+=3;
        ///cout<<f[3];
        //cout<<m1<<" "<<"a";
        //m1="a";
        //if(m1=="a")cout<<1;
        if(b1==b2)f[m1]++,f[m2]++;
        if(b1<b2)f[m2]+=3;
    }
    for(int i=1;i<=n;i++)
    {
        so[i].name=nm[i];
        so[i].point=f[nm[i]];
        //cout<<nm[i]<<" "<<f[nm[i]]<<endl;
    }
    sort(so+1,so+n+1,cmp);
    sort(so+1,so+n/2+1,cmp2);
    for(int i=1;i<=n/2;i++)
    {
        cout<<so[i].name<<endl;
        //cout<<so[i].point<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
struct node
{
    string name;
    int point,sum,jing;
}so[51];
bool cmp(node a,node b)
{
    if(a.point==b.point)
    {
        if(a.jing==b.jing)
        return a.sum>b.sum;
        else
        return a.jing>b.jing;
    }
    else
    return a.point>b.point;
}
bool cmp2(node a,node b)
{
    //for(int i=0;i<a.name.size();i++)if(a.name[i]>='A'&&a.name[i]<='Z')a.name[i]+=32;
    //for(int i=0;i<b.name.size();i++)if(b.name[i]>='A'&&b.name[i]<='Z')b.name[i]+=32;
    //if(a.name.size()==b.name.size())
    return a.name<b.name;
    //else
    //return a.name.size()<b.name.size();
}
int n,b1,b2;
string nm[51];
char c;
map<string,int> f,kin,sen;
string a,m1,m2;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a;
        //scanf("%s",a);
        nm[i]=a;
        kin[a]=0;
        f[a]=0;
        sen[a]=0;
        //f.insert(make_pair(a,0));
    }

    for(int i=1;i<=n*(n-1)/2;i++)
    {//cin.ignore();
        m1="";m2="";b1=0;b2=0;
        while(1)
        {
            scanf("%c",&c);
            //cout<<c<<" ";
            if(c=='\n')continue;
            if(c=='-')break;
            else
            if((c>='A'&&c<='Z')||(c>='a'&&c<='z'))m1+=c;
        }
        while(1)
        {
            scanf("%c",&c);
            if(c==' ')break;
            else
            m2+=c;
        }
        while(1)
        {
            scanf("%c",&c);
            if(c==':')break;
            else
            b1*=10,b1+=c-'0';
        }
        cin>>b2;
        sen[m1]+=b1-b2;sen[m2]+=b2-b1;
        kin[m1]+=b1;kin[m2]+=b2;
        //scanf("%s-%s %d:%d",&m1,&m2,&b1,&b2);
        //cout<<m1<<" "<<b1<<" "<<m2<<" "<<b2<<endl;
        if(b1>b2)f[m1]+=3;
        ///cout<<f[3];
        //cout<<m1<<" "<<"a";
        //m1="a";
        //if(m1=="a")cout<<1;
        if(b1==b2)f[m1]++,f[m2]++;
        if(b1<b2)f[m2]+=3;
    }
    for(int i=1;i<=n;i++)
    {
        so[i].name=nm[i];
        so[i].point=f[nm[i]];
        so[i].sum=kin[nm[i]];
        so[i].jing=sen[nm[i]];
        //cout<<nm[i]<<" "<<f[nm[i]]<<endl;
    }
    sort(so+1,so+n+1,cmp);
    sort(so+1,so+n/2+1,cmp2);
    for(int i=1;i<=n/2;i++)
    {
        cout<<so[i].name<<endl;
        //cout<<so[i].point<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct score{
	string s;
	int goal,miss,point;
};
score a[55];
int n,x,y;
string s,b,c;
bool fix(score ab,score cd){
	if(ab.point!=cd.point)return ab.point>cd.point;
	if(ab.goal-ab.miss!=cd.goal-cd.miss)return ab.goal-ab.miss>cd.goal-cd.miss;
	return ab.goal>cd.goal;
}
bool fix2(score ab,score cd){
	return ab.s<cd.s;
}
int main(){
	cin >> n;
	for(int i=0;i<n;i++)
		cin >> a[i].s;
	for(int i=0;i<n*(n-1)/2;i++){
		cin >> s;
		scanf("%d:%d",&x,&y);
		b=c="";
		int z=0;
		while(s[z]!='-'){
			b+=s[z];
			z++;
		}
		z=s.size()-1;
		while(s[z]!='-'){
			c.insert(c.begin(),s[z]);
			z--;
		}
		for(int i=0;i<n;i++)
			if(b==a[i].s){
				if(x>y)a[i].point+=3;
				if(x==y)a[i].point+=1;
				a[i].goal+=x;
				a[i].miss+=y;
			}
		for(int i=0;i<n;i++)
			if(c==a[i].s){
				if(x<y)a[i].point+=3;
				if(x==y)a[i].point+=1;
				a[i].goal+=y;
				a[i].miss+=x;
			}
	}
	sort(a,a+n,fix);
	sort(a,a+n/2,fix2);
	for(int i=0;i<n/2;i++)
		cout << a[i].s << endl;
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

string na[100],s;
map<string,int> sum;
map<string,int> jing;
map<string,int> goal;

struct team
{
	int win,sum,jin;
	string name;
}_[2333];

bool cmp(team a,team b)
{
	if(a.sum==b.sum)
	{
		if(a.win==b.win)
		{
			return a.jin>b.jin;
		}
		else
		return a.win>b.win;
	}
	else
	return a.sum>b.sum;
}

bool cmp2(team a,team b)
{
	return a.name<b.name;
}

int main()
{
	int n,i;
	scanf("%d",&n);
	for(i=1;i<=n;++i)
	{
		cin>>na[i];
		_[i].name=na[i];
		sum[na[i]]=0;
		goal[na[i]]=0;
		jing[na[i]]=0;
	}
	int l=(n*(n-1))/2;
	for(i=1;i<=l;++i)
	{
		int j=0,k,g1=0,g2=0;
		char maohao;
		string temp,t1,t2;
		t1="";
		t2="";
		cin>>temp;
		while(temp[j]!='-')
		{
			t1+=temp[j];
			j++;
		}
		j++;
		for(k=j;k<temp.length();++k)
		t2+=temp[k];
		cin>>g1>>maohao>>g2;
		if(g1>g2)
		{
			sum[t1]+=3;
			goal[t1]+=g1;
			goal[t2]+=g2;
			jing[t1]+=g1-g2;
			jing[t2]+=g2-g1;
		}
		if(g1<g2)
		{
			sum[t2]+=3;
			goal[t1]+=g1;
			goal[t2]+=g2;
			jing[t2]+=g2-g1;
			jing[t1]+=g1-g2;
		}
		if(g1==g2)
		{
			sum[t1]++;
			sum[t2]++;
			goal[t1]+=g1;
			goal[t2]+=g2;
		}
	}
	for(i=1;i<=n;++i)
	{
		_[i].jin=goal[na[i]];
		_[i].win=jing[na[i]];
		_[i].sum=sum[na[i]];
	}
	sort(_+1,_+1+n,cmp);
	sort(_+1,_+1+n/2,cmp2);
	for(i=1;i<=n/2;++i)
	{
		cout<<_[i].name<<endl;
	}
	return 0;
}
//C-D 0:3
//0123456


#include<bits/stdc++.h>

using namespace std;

string na[100],s;
map<string,int> sum;
map<string,int> jing;
map<string,int> goal;

struct team
{
	int win,sum,jin;
	string name;
}_[2333];

bool cmp(team a,team b)
{
	if(a.sum==b.sum)
	{
		if(a.win==b.win)
		{
			return a.jin>b.jin;
		}
		else
		return a.win>b.win;
	}
	else
	return a.sum>b.sum;
}

bool cmp2(team a,team b)
{
	return a.name<b.name;
}

int main()
{
	int n,i;
	scanf("%d",&n);
	for(i=1;i<=n;++i)
	{
		cin>>na[i];
		_[i].name=na[i];
		sum[na[i]]=0;
		goal[na[i]]=0;
		jing[na[i]]=0;
	}
	int l=(n*(n-1))/2;
	for(i=1;i<=l;++i)
	{
		int j=0,k,g1=0,g2=0;
		char maohao;
		string temp,t1,t2;
		t1="";
		t2="";
		cin>>temp;
		while(temp[j]!='-')
		{
			t1+=temp[j];
			j++;
		}
		j++;
		for(k=j;k<temp.length();++k)
		t2+=temp[k];
		cin>>g1>>maohao>>g2;
		if(g1>g2)
		{
			sum[t1]+=3;
			goal[t1]+=g1;
			goal[t2]+=g2;
			jing[t1]+=g1-g2;
		}
		if(g1<g2)
		{
			sum[t2]+=3;
			goal[t1]+=g1;
			goal[t2]+=g2;
			jing[t2]+=g2-g1;
		}
		if(g1==g2)
		{
			sum[t1]++;
			sum[t2]++;
			goal[t1]+=g1;
			goal[t2]+=g2;
		}
	}
	for(i=1;i<=n;++i)
	{
		_[i].jin=goal[na[i]];
		_[i].win=jing[na[i]];
		_[i].sum=sum[na[i]];
	}
	sort(_+1,_+1+n,cmp);
	sort(_+1,_+1+n/2,cmp2);
	for(i=1;i<=n/2;++i)
	{
		cout<<_[i].name<<endl;
	}
	return 0;
}
//C-D 0:3
//0123456


#include <iostream>
#include <string>
#include <sstream>
using namespace std;

struct team
{
	team(){x[0] = 0; x[1] = 0; x[2] = 0;}
	string str;
	int x[3];

	bool operator < ( const team &n ) const
	{
		for( int i = 0; i < 3; i++ )
		{
			if( x[i] != n.x[i] )
				return (x[i] < n.x[i]);
		}
		return false;
	}
};

int main()
{
	struct team a[55];
	int n;
	cin >> n;
	for( int i=0 ; i<n ; i++ )
		cin >> a[i].str;
	string clrbuf;
	getline( cin , clrbuf );
	int k = n*(n-1)/2;
	string str , name[2];
	int s[2] , t;
	stringstream ssin;
	for( int i=0 ; i<k ; i++ )
	{
		getline( cin , str );
		for( int i=0 ; i<str.size() ; i++ )
			if( str[i] == ':' || str[i] == '-' )
				str[i] = ' ';
		ssin.clear();
		ssin.str(str);
		ssin >> name[0] >> name[1] >> s[0] >> s[1];
		t = 0;
		for( int j=0 ; j<n && t<2 ; j++  )
		{
			if( a[j].str == name[t] )
			{
				if( s[t] == s[1-t] )
				{
					a[j].x[0]++;
					a[j].x[2]+=s[t];
				}
				else if( s[t] > s[1-t] )
				{
					a[j].x[0] += 3;
					a[j].x[2] += s[t];
					a[j].x[1] += (s[t]-s[1-t]);
				}
				else
				{
					a[j].x[2]+=s[t];
					a[j].x[1] += (s[t]-s[1-t]);
				}
				t++;
			}
		}
	}
	sort( a , a+n);
	string h[30];
	for( int i=n/2 ; i<n ; i++ )
		h[i - (n/2)] = a[i].str;
	sort( h , h+(n/2) );
	for( int i=0 ; i<n/2 ; i++ )
		cout << h[i] << endl;
	return 0;
}

/*
4
A
B
C
D
A-B 1:1
A-C 2:2
A-D 1:0
B-C 1:0
B-D 0:3
C-D 0:3

*/


#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
using namespace std;

struct team
{
	team(){x[0] = 0; x[1] = 0; x[2] = 0;}
	string str;
	int x[3];

	bool operator < ( const team &n ) const
	{
		for( int i = 0; i < 3; i++ )
		{
			if( x[i] != n.x[i] )
				return (x[i] < n.x[i]);
		}
		return 0;
	}
};

int main()
{
	struct team a[55];
	int n;
	cin >> n;
	for( int i=0 ; i<n ; i++ )
		cin >> a[i].str;
	string clrbuf;
	getline( cin , clrbuf );
	int k = n*(n-1)/2;
	string str , name[2];
	int s[2] , t;
	stringstream ssin;
	for( int i=0 ; i<k ; i++ )
	{
		getline( cin , str );
		for( int j=0 ; j<str.size() ; j++ )
			if( str[j] == ':' || str[j] == '-' )
				str[j] = ' ';
		ssin.clear();
		ssin.str(str);
		ssin >> name[0] >> name[1] >> s[0] >> s[1];
		t = 0;
		for( int j=0 ; j<n && t<2 ; j++  )
		{
			if( a[j].str == name[t] )
			{
				if( s[t] == s[1-t] )
				{
					a[j].x[0]++;
					a[j].x[2] += s[t];
				}
				else if( s[t] > s[1-t] )
				{
					a[j].x[0] += 3;
					a[j].x[2] += s[t];
					a[j].x[1] += (s[t]-s[1-t]);
				}
				else
				{
					a[j].x[2] += s[t];
					a[j].x[1] += (s[t]-s[1-t]);
				}
				t++;
			}
		}
	}
	sort( a , a+n);
	string h[30];
	for( int i=(n/2) ; i<n ; i++ )
		h[i - (n/2)] = a[i].str;
	sort( h , h+(n/2) );
	for( int i=0 ; i<(n/2) ; i++ )
		cout << h[i] << endl;
	return 0;
}

/*
4
A
B
C
D
A-B 1:1
A-C 2:2
A-D 1:0
B-C 1:0
B-D 0:3
C-D 0:3

*/


#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
using namespace std;

struct team
{
	team(){x[0] = 0; x[1] = 0; x[2] = 0;}
	string str;
	int x[3];

	bool operator < ( const team &n ) const
	{
		for( int i = 0; i < 3; i++ )
		{
			if( x[i] != n.x[i] )
				return (x[i] < n.x[i]);
		}
		return 0;
	}
};

int main()
{
	struct team a[55];
	int n;
	cin >> n;
	for( int i=0 ; i<n ; i++ )
		cin >> a[i].str;
	string clrbuf;
	getline( cin , clrbuf );
	int k = (n*(n-1))/2;
	string str , name[2];
	int s[2] , t;
	stringstream ssin;
	for( int i=0 ; i<k ; i++ )
	{
		getline( cin , str );
		for( int j=0 ; j<str.size() ; j++ )
			if( str[j] == ':' || str[j] == '-' )
				str[j] = ' ';
		ssin.clear();
		ssin.str(str);
		ssin >> name[0] >> name[1] >> s[0] >> s[1];
		t = 0;
		for( int j=0 ; j<n && t<2 ; j++  )
		{
			if( a[j].str == name[t] )
			{
				if( s[t] == s[1-t] )
				{
					a[j].x[0]++;
					a[j].x[2] += s[t];
				}
				else if( s[t] > s[1-t] )
				{
					a[j].x[0] += 3;
					a[j].x[2] += s[t];
					a[j].x[1] += (s[t]-s[1-t]);
				}
				else
				{
					a[j].x[2] += s[t];
					a[j].x[1] += (s[t]-s[1-t]);
				}
				t++;
				j = -1;
			}
		}
	}
	sort( a , a+n);
	string h[30];
	//for( int i=0 ; i<n ; i++ )
		//cout << a[i].str << " " << a[i].x[0] << " " << a[i].x[1] << " " << a[i].x[2] << endl;
	for( int i=(n/2) ; i<n ; i++ )
		h[i - (n/2)] = a[i].str;
	sort( h , h+(n/2) );
	for( int i=0 ; i<(n/2) ; i++ )
		cout << h[i] << endl;
	return 0;
}

/*
4
A
B
C
D
D-B 1:1
D-C 2:2
D-A 1:0
B-C 1:0
B-A 0:3
C-A 0:3

*/


#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
using namespace std;

struct team
{
	team(){x[0] = 0; x[1] = 0; x[2] = 0;}
	string str;
	int x[3];

	bool operator < ( const team &n ) const
	{
		for( int i = 0; i < 3; i++ )
		{
			if( x[i] != n.x[i] )
				return (x[i] < n.x[i]);
		}
		return false;
	}
};

int main()
{
	struct team a[55];
	int n;
	cin >> n;
	for( int i=0 ; i<n ; i++ )
		cin >> a[i].str;
	string clrbuf;
	getline( cin , clrbuf );
	int k = n*(n-1)/2;
	string str , name[2];
	int s[2] , t;
	stringstream ssin;
	for( int i=0 ; i<k ; i++ )
	{
		getline( cin , str );
		for( int i=0 ; i<str.size() ; i++ )
			if( str[i] == ':' || str[i] == '-' )
				str[i] = ' ';
		ssin.clear();
		ssin.str(str);
		ssin >> name[0] >> name[1] >> s[0] >> s[1];
		t = 0;
		for( int j=0 ; j<n && t<2 ; j++  )
		{
			if( a[j].str == name[t] )
			{
				if( s[t] == s[1-t] )
				{
					a[j].x[0]++;
					a[j].x[2]+=s[t];
				}
				else if( s[t] > s[1-t] )
				{
					a[j].x[0] += 3;
					a[j].x[2] += s[t];
					a[j].x[1] += (s[t]-s[1-t]);
				}
				else
				{
					a[j].x[2]+=s[t];
					a[j].x[1] += (s[t]-s[1-t]);
				}
				t++;
			}
		}
	}
	sort( a , a+n);
	string h[30];
	for( int i=n/2 ; i<n ; i++ )
		h[i - (n/2)] = a[i].str;
	sort( h , h+(n/2) );
	for( int i=0 ; i<n/2 ; i++ )
		cout << h[i] << endl;
	return 0;
}

/*
4
A
B
C
D
A-B 1:1
A-C 2:2
A-D 1:0
B-C 1:0
B-D 0:3
C-D 0:3

*/


#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
using namespace std;

struct team
{
	team(){x[0] = 0; x[1] = 0; x[2] = 0;}
	string str;
	int x[3];

	bool operator < ( const team &n ) const
	{
		for( int i = 0; i < 3; i++ )
		{
			if( x[i] != n.x[i] )
				return (x[i] < n.x[i]);
		}
		return 0;
	}
};

bool operator /( const string &one , const string &two )
{
	int mx = max( one.size() , two.size() ) , mn = one.size() + two.size() - mx;
	for( int i=0 ; i<mn ; i++ )
		if( one[i] != two[i] )
			return one[i] < two[i];
	return one.size() > two.size();
}

void sort( string a[] , int n  )
{
	for( int i=0 ; i<n ; i++ )
		for( int j=0 ; j<n-1 ; j++ )
			if( a[i] / a[j] )
				swap( a[i] , a[j] );
}

int main()
{
	struct team a[55];
	int n;
	cin >> n;
	for( int i=0 ; i<n ; i++ )
		cin >> a[i].str;
	string clrbuf;
	getline( cin , clrbuf );
	int k = (n*(n-1))/2;
	string str , name[2];
	int s[2] , t;
	stringstream ssin;
	for( int i=0 ; i<k ; i++ )
	{
		getline( cin , str );
		for( int j=0 ; j<str.size() ; j++ )
			if( str[j] == ':' || str[j] == '-' )
				str[j] = ' ';
		ssin.clear();
		ssin.str(str);
		ssin >> name[0] >> name[1] >> s[0] >> s[1];
		t = 0;
		for( int j=0 ; j<n && t<2 ; j++  )
		{
			if( a[j].str == name[t] )
			{
				if( s[t] == s[1-t] )
				{
					a[j].x[0]++;
					a[j].x[2] += s[t];
				}
				else if( s[t] > s[1-t] )
				{
					a[j].x[0] += 3;
					a[j].x[2] += s[t];
					a[j].x[1] += (s[t]-s[1-t]);
				}
				else
				{
					a[j].x[2] += s[t];
					a[j].x[1] += (s[t]-s[1-t]);
				}
				t++;
			}
		}
	}
	sort( a , a+n);
	string h[30];
	for( int i=(n/2) ; i<n ; i++ )
		h[i - (n/2)] = a[i].str;
	sort( h , n/2 );
	for( int i=0 ; i<(n/2) ; i++ )
		cout << h[i] << endl;
	return 0;
}

/*
4
A
B
C
D
A-B 1:1
A-C 2:2
A-D 1:0
B-C 1:0
B-D 0:3
C-D 0:3

*/


#include<iostream>
#include<string>
#include<map>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<string.h>
#include<algorithm>
#include<set>
using namespace std;
struct Point{
    int sc,goal;
    string ss;
}p[510];
bool cmp(Point a,Point b)
{
    if(a.sc==b.sc) return a.goal>b.goal;
    return a.sc>b.sc;
}
map<string,int>xkey;
int main()
{
    xkey.clear();
    int n,num1,num2;
    string s,s1,s2,str;
    scanf("%d",&n);
    for(int i=0;i<n;i++) {
        cin>>s;
        xkey[s]=i;
    }
    int m=(n*(n-1))/2;
    for(int i=0;i<m;i++)
    {
        cin>>str;
        scanf("%d:%d",&num1,&num2);
        int pos=str.find('-'),len=str.length();
        s1="";s2="";
        for(int j=0;j<pos;j++) s1+=str[j];
        for(int j=pos+1;j<len;j++) s2+=str[j];
        if(num1>num2) {
            p[xkey[s1]].sc+=3;
            p[xkey[s1]].goal+=num1-num2;
            p[xkey[s2]].goal+=num2-num1;
        }
        else if(num1<num2)  {
            p[xkey[s2]].sc+=3;
            p[xkey[s1]].goal+=num1-num2;
            p[xkey[s2]].goal+=num2-num1;
        }
        else {
            p[xkey[s1]].sc+=1;
            p[xkey[s2]].sc+=1;
        }
        p[xkey[s1]].ss=s1;
        p[xkey[s2]].ss=s2;
    }
    sort(p,p+n,cmp);
    set<string>x;
    x.clear();
    for(int i=0;i<n/2;i++)
        x.insert(p[i].ss);
    set<string>::iterator itr;
    for(itr=x.begin();itr!=x.end();itr++)
        cout<<*itr<<endl;
    return 0;
}


#include<iostream>
#include<string>
#include<map>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<set>
using namespace std;
struct Point{
	int sc,goal;
	string ss;
}p[510];
bool cmp(Point a,Point b)
{
	if(a.sc==b.sc) return a.goal>b.goal;
	return a.sc>b.sc;
}
map<string,int>xkey;
int main()
{
	int n,num1,num2;
	string s,s1,s2,str;
	char cm;
	scanf("%d",&n);
	for(int i=0;i<n;i++) {
		cin>>s;
		xkey[s]=i;
	}
	int m=n*(n-1)/2;
	memset(p,0,sizeof(p));
	for(int i=0;i<m;i++)
	{
		cin>>str;
		scanf("%d:%d",&num1,&num2);
		int pos=str.find('-');
		s1="";s2="";
		for(int i=0;i<pos;i++) s1+=str[i];
		for(int i=pos+1;i<str.length();i++) s2+=str[i];
		if(num1>num2) {
			p[xkey[s1]].sc+=3;
			p[xkey[s1]].goal+=num1-num2;
			p[xkey[s2]].goal+=num2-num1;
		}
		else if(num1<num2)	{
			p[xkey[s2]].sc+=3;
			p[xkey[s1]].goal+=num1-num2;
			p[xkey[s2]].goal+=num2-num1;
		}
		else {
			p[xkey[s1]].sc+=1;
			p[xkey[s2]].sc+=1;
		}
		p[xkey[s1]].ss=s1;
		p[xkey[s2]].ss=s2;
	}
	sort(p,p+n,cmp);
	set<string>x;
	for(int i=0;i<n/2;i++)
		x.insert(p[i].ss);
	set<string>::iterator itr;
	for(itr=x.begin();itr!=x.end();itr++)
		cout<<*itr<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<map>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<string.h>
#include<algorithm>
#include<set>
using namespace std;
struct Point{
	int sc,goal;
	string ss;
}p[510];
bool cmp(Point a,Point b)
{
	if(a.sc==b.sc) return a.goal>b.goal;
	return a.sc>b.sc;
}
map<string,int>xkey;
int main()
{
	int n,num1,num2;
	string s,s1,s2,str;
	scanf("%d",&n);
	for(int i=0;i<n;i++) {
		cin>>s;
		xkey[s]=i;
	}
	int m=n*(n-1)/2;
	memset(p,0,sizeof(p));
	for(int i=0;i<m;i++)
	{
		cin>>str;
		scanf("%d:%d",&num1,&num2);
		int pos=str.find('-'),len=str.length();
		s1="";s2="";
		for(int j=0;j<pos;j++) s1+=str[j];
		for(int j=pos+1;j<len;j++) s2+=str[j];
		if(num1>num2) {
			p[xkey[s1]].sc+=3;
			p[xkey[s1]].goal+=num1-num2;
			p[xkey[s2]].goal+=num2-num1;
		}
		else if(num1<num2)	{
			p[xkey[s2]].sc+=3;
			p[xkey[s1]].goal+=num1-num2;
			p[xkey[s2]].goal+=num2-num1;
		}
		else {
			p[xkey[s1]].sc+=1;
			p[xkey[s2]].sc+=1;
		}
		p[xkey[s1]].ss=s1;
		p[xkey[s2]].ss=s2;
	}
	sort(p,p+n,cmp);
	set<string>x;
	for(int i=0;i<n/2;i++)
		x.insert(p[i].ss);
	set<string>::iterator itr;
	for(itr=x.begin();itr!=x.end();itr++)
		cout<<*itr<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<map>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<set>
using namespace std;
struct Point{
	int sc,goal;
	string ss;
}p[510];
bool cmp(Point a,Point b)
{
	if(a.sc==b.sc) return a.goal>b.goal;
	return a.sc>b.sc;
}
map<string,int>xkey;
int main()
{
	int n,num1,num2;
	string s,s1,s2,str;
	char cm;
	scanf("%d",&n);
	for(int i=0;i<n;i++) {
		cin>>s;
		xkey[s]=i;
	}
	int m=n*(n-1)/2;
	memset(p,0,sizeof(p));
	for(int i=0;i<m;i++)
	{
		cin>>str;
		scanf("%d:%d",&num1,&num2);
		int pos=str.find('-');
		s1="";s2="";
		for(int j=0;j<pos;j++) s1+=str[j];
		for(int j=pos+1;j<str.length();j++) s2+=str[j];
		if(num1>num2) {
			p[xkey[s1]].sc+=3;
			p[xkey[s1]].goal+=num1-num2;
			p[xkey[s2]].goal+=num2-num1;
		}
		else if(num1<num2)	{
			p[xkey[s2]].sc+=3;
			p[xkey[s1]].goal+=num1-num2;
			p[xkey[s2]].goal+=num2-num1;
		}
		else {
			p[xkey[s1]].sc+=1;
			p[xkey[s2]].sc+=1;
		}
		p[xkey[s1]].ss=s1;
		p[xkey[s2]].ss=s2;
	}
	sort(p,p+n,cmp);
	set<string>x;
	for(int i=0;i<n/2;i++)
		x.insert(p[i].ss);
	set<string>::iterator itr;
	for(itr=x.begin();itr!=x.end();itr++)
		cout<<*itr<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<map>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<string.h>
#include<algorithm>
#include<set>
using namespace std;
struct Point{
    int sc,goal,go;
    string ss;
}p[510];
bool cmp(Point a,Point b)
{
    if(a.sc==b.sc)
    {
        if(a.goal==b.goal)
            return a.go>b.go;
        return a.goal>b.goal;
    }
    return a.sc>b.sc;
}
map<string,int>xkey;
int main()
{
    xkey.clear();
    int n,num1,num2;
    string s,s1,s2,str;
    scanf("%d",&n);
    for(int i=0;i<n;i++) {
        cin>>s;
        xkey[s]=i;
    }
    int m=(n*(n-1))/2;
    for(int i=0;i<m;i++)
    {
        cin>>str;
        scanf("%d:%d",&num1,&num2);
        int pos=str.find('-'),len=str.length();
        s1="";s2="";
        for(int j=0;j<pos;j++) s1+=str[j];
        for(int j=pos+1;j<len;j++) s2+=str[j];
        p[xkey[s1]].go+=num1;
        p[xkey[s2]].go+=num2;
        if(num1>num2) {
            p[xkey[s1]].sc+=3;
            p[xkey[s1]].goal+=num1-num2;
            p[xkey[s2]].goal+=num2-num1;
        }
        else if(num1<num2)  {
            p[xkey[s2]].sc+=3;
            p[xkey[s1]].goal+=num1-num2;
            p[xkey[s2]].goal+=num2-num1;
        }
        else {
            p[xkey[s1]].sc+=1;
            p[xkey[s2]].sc+=1;
        }
        p[xkey[s1]].ss=s1;
        p[xkey[s2]].ss=s2;
    }
    sort(p,p+n,cmp);
    set<string>x;
    x.clear();
    for(int i=0;i<n/2;i++)
        x.insert(p[i].ss);
    set<string>::iterator itr;
    for(itr=x.begin();itr!=x.end();itr++)
        cout<<*itr<<endl;
    return 0;
}


#include<iostream>
#include<string>
#include<map>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<set>
using namespace std;
struct Point{
	int sc,goal;
	string ss;
}p[51];
bool cmp(Point a,Point b)
{
	if(a.sc==b.sc) return a.goal>b.goal;
	return a.sc>b.sc;
}
map<string,int>xkey;
int main()
{
	int n,num1,num2;
	string s,s1,s2,str;
	char cm;
	scanf("%d",&n);
	for(int i=0;i<n;i++) {
		cin>>s;
			xkey[s]=i;
	}
	int m=n*(n-1)/2;
	memset(p,0,sizeof(p));
	for(int i=0;i<m;i++)
	{
		cin>>str;
		cin>>num1>>cm>>num2;
		//cout<<num1<<" "<<num2<<endl;
		int pos=str.find('-');
		s1="";s2="";
		for(int i=0;i<pos;i++) s1+=str[i];
		for(int i=pos+1;i<str.length();i++) s2+=str[i];
	//	cout<<s1<<"  "<<s2<<endl;
		if(num1>num2) {
			p[xkey[s1]].sc+=3;
			p[xkey[s1]].goal+=num1-num2;
			p[xkey[s2]].goal+=num2-num1;
		}
		else if(num1<num2)	{
			p[xkey[s2]].sc+=3;
			p[xkey[s1]].goal+=num1-num2;
			p[xkey[s2]].goal+=num2-num1;
		}
		else {
			p[xkey[s1]].sc+=1;
			p[xkey[s2]].sc+=1;
		}
		p[xkey[s1]].ss=s1;
		p[xkey[s2]].ss=s2;
	}
	sort(p,p+n,cmp);
	set<string>x;
	for(int i=0;i<n/2;i++)
	{
		x.insert(p[i].ss);
	//	cout<<p[i].sc<<" "<<p[i].goal<<" "<<p[i].ss<<endl;
	}
	set<string>::iterator itr;
	for(itr=x.begin();itr!=x.end();itr++)
		cout<<*itr<<endl;
	return 0;
}