#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <cmath>
#include <map>
#include <fstream>
#include <sstream>
#include <set>
#include <iomanip>
#include <deque>
#include <cstring>

#define pb push_back
#define ll long long
#define FOR(I,A,B) for(int I=(A); I <= (B); I++)

using namespace std;

struct team {
	string name;
	int goals;
	int score;
};

vector<team> s;

void add(string n1, int g1, int g2) {
	bool found = false;
		for(int j = 0; j < s.size(); j++) {
			if(n1.compare(s[j].name) == 0) {
				s[j].goals += g1;
				if(g1 > g2) s[j].score += 3;
				else if(g1 == g2) s[j].score++;
				found = true;
				break;
			}
		}
		if(!found) {
			team t;
			t.name = n1;
			t.goals = g1;
			t.score = 0;
			if(g1 > g2) t.score = 3;
			else if(g1 == g2) t.score = 1;
			s.pb(t);
		}
}

bool cmp(team a, team b) {
	return a.score > b.score ||
			(a.score == b.score && a.goals > b.goals) ||
			(a.goals == b.goals && a.name.compare(b.name) < 0);
}

int main() {
	for(int i = 0; i < 6; i++) {
		string n1, n2;
		int g1, g2;
		cin >> n1 >> n2 >> g1 >> g2;
		add(n1, g1, g2);
		add(n2, g2, g1);
	}

	sort(s.begin(), s.end(), cmp);

	for(int i = 0; i < 4; i++) {
		cout << s[i].name << s[i].score << " " << s[i].goals << "\n";
	}


	return 0;
}