// Arup Guha
// 9/30/2015
// Solution to 2003 UCF HS Contest Problem: Bits of Candy

import java.util.*;

public class candy {

	final public static String[] CANDY = {"Unknown candy bar!", "Planters", "Reeses_Pieces", "Unknown candy bar!",
		"Sugar_Babies", "Pay_Day", "Unknown candy bar!", "Unknown candy bar!", "Hersheys", "Goobers", "Reeses_Cups",
		"Nutrageous", "Caramello", "Baby_Ruth", "Milky_Way", "Snickers"};

	// And has higher precedence than or.
	final public static int AND = -1;
	final public static int OR = -2;

	// So other functions have it.
	public static HashMap<String,Integer> map;

	public static void main(String[] args) {

		// Create reverse look up, for ease.
		map = new HashMap<String,Integer>();
		for (int i=0; i<CANDY.length; i++)
			map.put(CANDY[i], i);

		Scanner stdin = new Scanner(System.in);
		int numCases = Integer.parseInt(stdin.nextLine());

		// Process each case.
		for (int loop=0; loop<numCases; loop++) {

			// Split up expression.
			StringTokenizer tok = new StringTokenizer(stdin.nextLine());
			ArrayList<Integer> exp = new ArrayList<Integer>();
			while (tok.hasMoreTokens())
				exp.add(getValue(tok.nextToken()));

			// Our result.
			System.out.println(CANDY[evaluate(exp)]);
		}
	}

	public static int evaluate(ArrayList<Integer> exp) {

		// Do Mult First
		int i = 1;
		while (i < exp.size()) {

			// Simplify this and.
			if (exp.get(i) == AND) {
				int left = exp.get(i-1);
				int right = exp.get(i+1);
				for (int j=0; j<3; j++) exp.remove(i-1);
				exp.add(i-1, left & right);
			}

			// Go to next term.
			else
				i += 2;
		}

		// Now that we know these are ORs, it's easy.
		int res = exp.get(0);
		for (i=2; i<exp.size(); i+=2)
			res |= exp.get(i);
		return res;
	}

	public static int getValue(String s) {

		// Get these out of the way.
		if (s.charAt(0) == '|') return OR;
		if (s.charAt(0) == '&') return AND;

		// Slow but fine for small input sizes.
		int neg = 0;
		while (s.charAt(0) == '~') {
			neg++;
			s = s.substring(1);
		}

		// Here is the regular bit value.
		return neg%2 == 0 ? map.get(s) : 15 - map.get(s);
	}
}