#include <iostream>
using namespace std;

int main()
{
	int n, score1, score2, ngame;
	cin >> ngame;
	for(int igame=1; igame<=ngame; igame++) {
		cin >> n;
		score1 = 0, score2 = 0;
		for(int i=0; i<n; i++) {
			int c1, c2;
			cin >> c1 >> c2;
			if (c1 == 5) {
				if (c2 == 4)
					score2 += 9;
				else if (c2 != 5)
					score1 += 5;
			}
			else if (c1 == 4) {
				if (c2 == 5)
					score1 += 9;
				else if (c2 == 3)
					score2 += 7;
				else if (c2 != 4)
					score1 += 4;
			}
			else if (c1 == 3) {
				if (c2 == 5)
					score2 += 5;
				else if (c2 == 4)
					score1 += 7;
				else if (c2 == 2)
					score2 += 5;
				else if (c2 == 1)
					score1 += 3;
			}
			else if (c1 == 2) {
				if (c2 > 3)
					score2 += c2;
				else if (c2 == 3)
					score1 += 5;
				else if (c2 == 1)
					score2 += 6;
			}
			else {
				if (c2 > 2)
					score2 += c2;
				else if (c2 == 2)
					score1 += 6;
			}
		}
		cout << "Game " << igame << ": Tessa " << score1 << " Danny " << score2 << endl;

	}
}
