// Arup Guha
// 7/17/2014
// Solution to 2006 UCF HS Contest Problem: Square in the...

import java.util.*;
import java.io.*;

public class square {

	public static void main(String[] args) throws Exception {

		Scanner stdin = new Scanner(new File("square.in"));
		int numGames = stdin.nextInt();

		// Go through each game.
		for (int loop=1; loop<=numGames; loop++) {

			int n = stdin.nextInt();
			ArrayList<player> all = new ArrayList<player>();
			int kefkaIndex = -1;

			// Read in players.
			for (int i=0; i<n; i++) {

				// Read player.
				String name = stdin.next();
				int total = stdin.nextInt();
				int hurt = stdin.nextInt();
				all.add(new player(name, total, hurt));

				// Assign Kefka's index.
				if (name.equals("Kefka"))
					kefkaIndex = i;
			}

			// Case header.
			System.out.println("Game #"+loop+":");

			int turn = 0;
			while (true) {

				// Go Kefka!
				if (turn == kefkaIndex) {

					int celes = kefkaIndex > 0 ? 0:1;

					// Always strike the first person!!!
					boolean res = all.get(turn).strike(all.get(celes));
					System.out.println(all.get(turn)+" struck "+all.get(celes)+" for "+all.get(turn).hurt+" points of hurt.");

					// Ha ha, he's gone!
					if (res) {
						System.out.println(all.get(celes)+" has been removed from the game.");
						all.remove(celes);
						if (kefkaIndex > 0) {
							kefkaIndex--;
							turn--;
						}

						// Only Kefka is left - ha ha ha!!!
						if (all.size() == 1) {
							System.out.println("The world will be cast into perpetual ruin.");
							break;
						}
					}
				}

				// Team Celes!!!
				else {

					// Play the turn and print the points.
					boolean res = all.get(turn).strike(all.get(kefkaIndex));
					System.out.println(all.get(turn)+" struck Kefka for "+all.get(turn).hurt+" points of hurt.");

					// See if Kefka is gone!
					if (res) {
						System.out.println("Kefka has been removed from the game.");
						System.out.println("The world has been saved!");
						break;
					}
				}

				// Advance to the next player.
				turn = (turn + 1)%all.size();
			}

			// Separate output between cases.
			System.out.println();
		}
	}
}

class player {

	public String name;
	public int hp;
	public int hurt;

	public player(String n, int total, int pain) {
		name = n;
		hp = total;
		hurt = pain;
	}

	public boolean strike(player other) {
		other.hp -= hurt;
		return other.hp <= 0;
	}

	public String toString() {
		return name;
	}
}