/* * Code by Spiromanul */ # include "iostream" # include "cstring" # include "vector" # include "queue" # include "bitset" # include "algorithm" # include "deque" # include "map" const char IN [ ] = "input" ; const char OUT [ ] = "output" ; const int MAX = 114 ; const int LENGTH = 5014 ; const int SIGMA = 27 ; const int MOD = 666013 ; # define pb push_back # define mp make_pair # define FORN( a , b , c ) for ( int a = b ; a <= c ; ++ a ) # define FORNBACK( a , b , c ) for ( int a = b ; a >= c ; -- a ) using namespace std; //ifstream cin ( IN ) ; //ofstream cout ( OUT ) ; long long int R(){ char r; bool start=false,neg=false; long long int ret=0; while(true){ r=getchar(); if((r-'0'<0 || r-'0'>9) && r!='-' && !start){ continue; } if((r-'0'<0 || r-'0'>9) && r!='-' && start){ break; } if(start)ret*=10; start=true; if(r=='-')neg=true; else ret+=r-'0'; } if(!neg) return ret; else return -ret; } map < string , int > hashin ; int main ( void ) { string a , b , c , d ; while ( cin >>a and cin >> b and cin >> c and cin >> d ) { int scor = 0 ; if ( c.length() == 2 ) scor = ( c [ 0 ] - '0' ) * 10 + c [ 1 ] ; else scor = ( c [ 0 ] - '0' ) ; int scor2 = 0 ; if ( d.length() == 2 ) scor2 = ( d [ 0 ] - '0' ) * 10 + d [ 1 ] ; else scor2 = ( d [ 0 ] - '0' ) ; if ( scor > scor2 ) hashin [ a ] += 3 , hashin [ b ] += 0 ; else if ( scor == scor2 ) { hashin [ a ] ++ ; hashin [ b ] ++ ; } else hashin [ b ] += 3 , hashin [ a ] += 0 ; } int ok = 1 ; while ( ok != -1 ) { ok = -1; string aa ; for ( auto x : hashin ) if ( x.second == -1 ) continue ; else if ( x.second > ok ) { ok = x.second ; aa = x.first ; } if ( ok != -1 ) { hashin [ aa ] = -1 ; cout << aa << '\n' ; } } for ( auto x : hashin ) if ( x.second != -1 ) cout << x.first << endl ; return 0; }