// Arup Guha
// 7/13/2014
// Solution to 2006 UCF HS Problem: Decisions, Decisions...

import java.util.*;
import java.util.*;
import java.io.*;

public class decisions {

	public static void main(String[] args) throws Exception {

		Scanner stdin = new Scanner(new File("decisions.in"));
		int loop = 1;

		// Go through each case.
		while (true) {

			// Read in first line.
			int curLoc = 0;
			int next1 = stdin.nextInt();
			int next2 = stdin.nextInt();

			// End of input.
			if (next1 == -1 && next2 == -1) break;

			// Set up look up chart.
			HashMap<Integer,Double> prob = new HashMap<Integer,Double>();
			prob.put(0, 1.0);

			// Go till end.
			while (curLoc != -1) {

				// Build off this square using independent probabilities and store.
				double curProb = prob.get(curLoc);
				double thisProb = prob.containsKey(next1) ? prob.get(next1) : 0;
				prob.put(next1, thisProb + curProb*.5);
				thisProb = prob.containsKey(next2) ? prob.get(next2) : 0;
				prob.put(next2, thisProb + curProb*.5);

				// Go to the next slot.
				curLoc = stdin.nextInt();
				next1 = stdin.nextInt();
				next2 = stdin.nextInt();
			}

			// Always get to the end.
			prob.put(-1,1.0);

			// Case header.
			System.out.println("Scenario #"+loop+":");

			// Process all queries.
			int query = stdin.nextInt();
			while (query != -1) {

				// See if this is valid and then answer.
				if (prob.containsKey(query))
					System.out.printf("Location %d: %.2f %%\n", query, prob.get(query)*100);
				else
					System.out.printf("Location %d: 0.00 %%\n", query);

				query = stdin.nextInt();
			};

			// For all cases.
			System.out.println("Hotel: 100.00 %\n");
			loop++;
		}

		stdin.close();
	}
}