public static void main(String[] args) {
		String base = "C:\\programs\\GCJ\\FullBinaryTree\\";
		String input = base + "input.in";
		String output = base + "output.out";
		Scanner sc = null;
		PrintWriter pw = null;

		try {
			sc = new Scanner(new FileReader(input));
			pw = new PrintWriter(output);

			int t = sc.nextInt();
			sc.nextLine();
			int count = 1;
			while (t-- > 0) {
				int n = sc.nextInt();
				HashMap<Integer, java.util.List<Integer>> maps = new HashMap<Integer, java.util.List<Integer>>();
				HashMap<Integer, Integer> degree = new HashMap<Integer, Integer>();
				for (int i = 0; i < n - 1; i++) {
					int[] v = { sc.nextInt(), sc.nextInt() };
					for (Integer vi : v) {
						if (degree.containsKey(vi)) {
							int val = degree.get(vi);
							degree.put(vi, val + 1);
						} else {
							degree.put(vi, 1);
						}
					}
					ArrayList<Integer> list;
					if (maps.get(v[0]) != null) {
						list = (ArrayList<Integer>) maps.get(v[0]);
					} else {
						list = new ArrayList<Integer>();
					}
					list.add(v[1]);
					maps.put(v[0], list);

					if (maps.get(v[1]) != null) {
						list = (ArrayList<Integer>) maps.get(v[1]);
					} else {
						list = new ArrayList<Integer>();
					}
					list.add(v[0]);
					maps.put(v[1], list);
				}
				int result = slove(maps, degree, n);
				pw.println("Case #" + (count++) + ": " + result);
			} 

		} catch (Exception ex) {
			ex.printStackTrace();
		} finally {
			if (sc != null)
				sc.close();
			if (pw != null)
				pw.close();
		}

	}