View Code of Problem 122

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int t = scan.nextInt();
		while (t-->0) {
			int n = scan.nextInt();
			int tmp = (n-1)*2;
			int[] arr = new int[tmp];
			for (int i = 0; i < arr.length; i++) {
				arr[i] = scan.nextInt();
			}
			if ((n-1)%2 == 1) {
				System.out.println("Alice");
			}else {
				System.out.println("Bob");
			}
		}
	}
}

Double click to view unformatted code.


Back to problem 122