#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define dbg(x) (cout<<#x<<" = "<<(x)<<'\n') #ifdef HOME const string inputFile = "input.txt"; const string outputFile = "output.txt"; #else const string problemName = ""; const string inputFile = problemName + ".in"; const string outputFile = problemName + ".out"; #endif typedef long long int lld; typedef pair PII; typedef pair PIL; typedef pair PLI; typedef pair PLL; const int INF = (1LL << 31) - 1; const lld LINF = (1LL << 62) - 1; const int dx[] = {1, 0, -1, 0, 1, -1, 1, -1}; const int dy[] = {0, 1, 0, -1, 1, -1, -1, 1}; const int MOD = (int)(1e9) + 7; const int NMAX = 100000 + 5; const int MMAX = 100000 + 5; const int KMAX = 100000 + 5; const int PMAX = 100000 + 5; const int LMAX = 100000 + 5; const int VMAX = 100000 + 5; map score; vector V; bool cmp(string A, string B) { if(A == B) return 1; if(score[A].first == score[B].first) { if(score[A].second == score[B].second) return A < B; return score[A].second > score[B].second; } return score[A].first < score[B].first; } int main() { int i, x, y; string A, B; #ifndef ONLINE_JUDGE freopen(inputFile.c_str(), "r", stdin); freopen(outputFile.c_str(), "w", stdout); #endif for(i = 1; i <= 6; i++) { cin >> A; cin >> B; cin >> x; cin >> y; if(x > y) score[A].first = score[A].first + 3; if(x < y) score[B].first = score[B].first + 3; if(x == y) { score[A].first = score[A].first + 1; score[B].first = score[B].first + 1; } score[A].second = score[A].second + x; score[B].second = score[B].second + y; V.push_back(A); V.push_back(B); } sort(V.rbegin(), V.rend(), cmp); unique(V.begin(), V.end()); for(int i = 0; i < 4; i++) cout << V[i] << '\n'; return 0; }