Bubli and shivani are in lab. Bubli wants to send a message to shivani. But he can't send it directly. Bubli is on 1st computer and shivani is on the nth computer. Now the computer's are connected in a chain. 1st is connected to 2nd, 2nd is connected to 3rd and so on. Now for shivani to read the message all computers between 1 and n(inclusive) should be on. But these computers are magical.1st computer is connected to a source.And there is a main button(for electricity).All the computers that are connected to source will toggle(will be switched off if it was on and will be switched on if it was off)when button is clicked. A computer is connected to the source if and only if all the computers before it are on. Initially all computers are switched off(including bubli's and shivani's computer). Now the button is clicked k times. Can you please tell whether shivani is able to read the message or not.Like initially all computer's are switched off. 1st time when the button is clicked 1st computer will switch on. 2nd time when button is clicked 1st will switched off and 2nd is switched on.3rd time when the button is clicked 1st will switched on and 2nd will remain switched on(because it was not connected to source since 1st computer was off) and so on.

Input

1st line will contain t(no. of test cases). Next t lines will contain two integers n(no. of computers) and k(no. of times main button is clicked.

Output

t lines containing "YES" or "NO" for each test case.

Limits

1 ≤ T ≤ 10,000.

1 ≤ N ≤ 30;

0 ≤ K ≤ 10^8;

SAMPLE INPUT
4
1 0
1 1
4 0
4 47

SAMPLE OUTPUT
NO
YES
NO
YES
t=int(input())
while (t>0):
	s = raw_input()
	tokens = s.split()
	n= int(tokens[0])
	k = int(tokens[1])
	temp=k%(2**n)
	if(temp==0):
		print("NO")
	elif(temp==(2**n)-1):
		print("YES")
	else:
		print("NO")
	t=t-1