party-game-1

Chef and Jhool  went to a party, and both  decided to play a game. The game is simple, both Chef and Jhool will eat the dishes served at the party till they are full, and the one who eats maximum number of  dishes is the winner. However, both of them can only eat a dish if they can finish it completely i.e. if Chef can eat only 60 Cal in a day and has already eaten dishes worth 50 Cal, then he can't eat a dish with calorie value greater than 10 Cal. 

Given that all the dishes served at the party are infinite in number, represented by their  calorie value(in Cal) and the amount of Cal, Chef and Jhool can eat in a day, our job is to find out who'll win, in case of a tie print “Tie” .

Input:

First line contains number of test cases T.
Each test case contains two lines.
First line contains three integers  X , Y and N. 
where X and Y is respectively the maximum amount of Calorie Chef and Jhool can eat per day, respectively and N is the number of dishes served at the party.
Next line contains N integers where ith integer is the amount of Calorie ith dish has.

Output:

For each test case print "Chef Won" (quotes for clarity) if Chef wins else if print "Jhool Won" (quotes for clarity) if Jhool wins else print "Tie" (quotes for clarity) if both eat equal number of dishes.

Constraints:

1 ≤ T ≤ 100
1 ≤ N ≤ 10000
1 ≤ Cal value of each dish ≤ 100000
1 ≤ X, Y ≤ 1000000000  

SAMPLE INPUT
3
15 20 3
10 5 4
10 8 3
4 5 5
3 10 2
4 7

SAMPLE OUTPUT
Jhool Won
Chef Won
Jhool Won

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
t=int(input())
for I in range(t):
	x,y,n=list(map(int,input().split()))
	ar=list(map(int,input().split()))
	ar=sorted(ar)
	sumx=0
	sumy=0
	cx=0
	cy=0
	for I in ar:
		if sumx<=x and sumx+I<=x:
			sumx=sumx+I
			cx=cx+1
	for I in ar:    
		if sumy<=y and sumy+I<=y:
			sumy=sumy+I
			cy=cy+1
	#print cx,cy        
	if cx>cy:
		print("Chef Won")
	elif cx<cy:
		print("Jhool Won")
	else:
		print("Tie")