// Arup Guha
// 4/34/2013
// Solution to 2013 UCF High School Contest Problem: Shenanigans
import java.io.*;
import java.util.*;

public class shenanigans {

	public static void main(String[] args) throws Exception {
		
		Scanner fin = new Scanner(new File("shenanigans.in"));
		int numCases = fin.nextInt();
				
		// Go through each case.
		for (int loop=1; loop<=numCases; loop++) {
			
			int n = fin.nextInt();
			int ad = 0; // 1 = andrew, 2 = gabe
			int status = 0; // 1 = andrew, 2 = gabe
			
			// Go through each turn.
			for (int i=0; i<n; i++) {
				String p1 = fin.next();
				String p2 = fin.next();
				
				// We know who won, so don't compute anything and keep on reading.
				if (status != 0) continue;
				
				// Play this round.
				int outcome = play(p1, p2); // 0 = tie, 1 = p1, 2 = p2
				
				// Edit our state as necessary.
				if (ad != 0 && outcome == 0) 
					status = ad;
				if (outcome != 0)
					ad = outcome;
			}
			
			// Print the result.
			if (status == 1)
				System.out.println("Game #"+loop+": Looks like Andrew won again.");
			else
				System.out.println("Game #"+loop+": Oh snap! Gabe beat Andrew!");
		}
	}
	
	// Brute force, returns the winner of the RPS game.
	public static int play(String a, String b) {
		if (a.equals(b)) return 0;
		if (a.equals("R") && b.equals("S")) return 1;
		if (a.equals("R") && b.equals("P")) return 2;
		if (a.equals("P") && b.equals("S")) return 2;
		if (a.equals("P") && b.equals("R")) return 1;
		if (a.equals("S") && b.equals("P")) return 1;
		return 2;
	}
}

