Luntik has decided to try singing. He has a one-minute songs, b two-minute songs and c three-minute songs. He wants to distribute all songs into two concerts such that every song should be included to exactly one concert.

He wants to make the absolute difference of durations of the concerts as small as possible. The duration of the concert is the sum of durations of all songs in that concert.

Please help Luntik and find the minimal possible difference in minutes between the concerts durations.

Input

The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases.

Each test case consists of one line containing three integers a, b, c (1 ≤ a, b, c ≤ 10^9) — the number of one-minute, two-minute and three-minute songs.

Output

For each test case print the minimal possible difference in minutes between the concerts durations.

Example

Input


4
1 1 1
2 1 3
5 5 5
1 1 2


Output


0
1
0
1

Note

In the first test case, Luntik can include a one-minute song and a two-minute song into the first concert, and a three-minute song into the second concert. Then the difference will be equal to 0.

In the second test case, Luntik can include two one-minute songs and a two-minute song and a three-minute song into the first concert, and two three-minute songs into the second concert. The duration of the first concert will be 1 + 1 + 2 + 3 = 7, the duration of the second concert will be 6. The difference of them is |7-6| = 1.
import java.io.*;
import java.util.*;

public class Main {

//	static boolean[] prime = new boolean[10000000];
	final static long mod = 1000000007;

	public static void main(String[] args) {
//		sieve();
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int t = in.nextInt();
		while(t-- > 0) {
			long s = 0;
			for(int i = 1; i <= 3; i++) {
				s += i*(in.nextInt());
			}
			out.println(s&1);
		}
		

		out.flush();
	}
	
	static boolean prime(long k) {
		for(int i = 2; i*i <= k; i++) {
			if(k%i == 0) {
				return false;
			}
		}
		return true;
	}

	static boolean check(Integer[] a) {
		int n = a.length % 2 == 0 ? a.length / 2 - 1 : a.length / 2;
		for (int i = 0; i + n < a.length; i++) {
			if (a[i] == a[i + n]) {
				return true;
			}
		}
		return false;
	}

	static long gcd(long a, long b) {
		if (a % b == 0) {
			return b;
		} else {
			return gcd(b, a % b);
		}
	}

	static void reverseArray(int[] a) {
		for (int i = 0; i < (a.length >> 1); i++) {
			int temp = a[i];
			a[i] = a[a.length - 1 - i];
			a[a.length - 1 - i] = temp;
		}
	}

	static Integer[] intInput(int n, InputReader in) {
		Integer[] a = new Integer[n];
		for (int i = 0; i < a.length; i++)
			a[i] = in.nextInt();
		return a;
	}

	static Long[] longInput(int n, InputReader in) {
		Long[] a = new Long[n];
		for (int i = 0; i < a.length; i++)
			a[i] = in.nextLong();
		return a;
	}

	static String[] strInput(int n, InputReader in) {
		String[] a = new String[n];
		for (int i = 0; i < a.length; i++)
			a[i] = in.next();
		return a;
	}

//	static void sieve() {
//		for (int i = 2; i * i < prime.length; i++) {
//			if (prime[i])
//				continue;	
//			for (int j = i * i; j < prime.length; j += i) {
//				prime[j] = true;
//			}
//		}
//	}

}

class Graph {
	private ArrayList<HashSet<Integer>> g;
	private HashSet<Integer> vertices, leaves;

	Graph(int n) {
		g = new ArrayList<>();
		vertices = new HashSet<>();
		for (int i = 0; i < n; i++) {
			g.add(new HashSet<>());
			vertices.add(i);
		}
		leaves = new HashSet<>();
	}

	void add(int a, int b) {
		g.get(a).add(b);
		g.get(b).add(a);
	}

	void addLeaves() {
		for (int i = 0; i < g.size(); i++) {
			if (g.get(i).size() == 1) {
				leaves.add(i);
			}
		}
	}

	int vertices() {
		return vertices.size();
	}
}

class Data {
	int val;
	int ind;

	Data(int val, int ind) {
		this.val = val;
		this.ind = ind;
	}
}

class Node {
	int val;
	ArrayList<Node> c;

	Node(int val) {
		this.val = val;
		c = new ArrayList<>();
	}
}

class compareVal implements Comparator<Data> {

	@Override
	public int compare(Data o1, Data o2) {
//		return (o1.val - o2.val == 0 ? o1.ind - o2.ind : o1.val - o2.val);
		return (o1.val - o2.val);
	}

}

class compareInd implements Comparator<Data> {

	@Override
	public int compare(Data o1, Data o2) {
		return o1.ind - o2.ind == 0 ? o1.val - o2.val : o1.ind - o2.ind;
	}

}

class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	long nextLong() {
		return Long.parseLong(next());
	}

	double nextDouble() {
		return Double.parseDouble(next());
	}

	String nextLine() {
		String str = "";
		try {
			str = reader.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return str;
	}

}