For the New Year, Polycarp decided to send postcards to all his $n$ friends. He wants to make postcards with his own hands. For this purpose, he has a sheet of paper of size $w \times h$, which can be cut into pieces.

Polycarp can cut any sheet of paper $w \times h$ that he has in only two cases:

If $w$ is even, then he can cut the sheet in half and get two sheets of size $\frac{w}{2} \times h$;

If $h$ is even, then he can cut the sheet in half and get two sheets of size $w \times \frac{h}{2}$;

If $w$ and $h$ are even at the same time, then Polycarp can cut the sheet according to any of the rules above.

After cutting a sheet of paper, the total number of sheets of paper is increased by $1$.

Help Polycarp to find out if he can cut his sheet of size $w \times h$ at into $n$ or more pieces, using only the rules described above.


-----Input-----

The first line contains one integer $t$ ($1 \le t \le 10^4$) — the number of test cases. Then $t$ test cases follow.

Each test case consists of one line containing three integers $w$, $h$, $n$ ($1 \le w, h \le 10^4, 1 \le n \le 10^9$) — the width and height of the sheet Polycarp has and the number of friends he needs to send a postcard to.


-----Output-----

For each test case, output on a separate line:

"YES", if it is possible to cut a sheet of size $w \times h$ into at least $n$ pieces;

"NO" otherwise.

You can output "YES" and "NO" in any case (for example, the strings yEs, yes, Yes and YES will be recognized as positive).


-----Examples-----

Input
5
2 2 3
3 3 2
5 10 2
11 13 1
1 4 4
Output
YES
NO
YES
YES
YES


-----Note-----

In the first test case, you can first cut the $2 \times 2$ sheet into two $2 \times 1$ sheets, and then cut each of them into two more sheets. As a result, we get four sheets $1 \times 1$. We can choose any three of them and send them to our friends.

In the second test case, a $3 \times 3$ sheet cannot be cut, so it is impossible to get two sheets.

In the third test case, you can cut a $5 \times 10$ sheet into two $5 \times 5$ sheets.

In the fourth test case, there is no need to cut the sheet, since we only need one sheet.

In the fifth test case, you can first cut the $1 \times 4$ sheet into two $1 \times 2$ sheets, and then cut each of them into two more sheets. As a result, we get four sheets $1 \times 1$.

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Greedy algorithms


Solutions:
for _ in range(int(input())):
	(w, h, n) = map(int, input().split())
	c = 1
	while w % 2 == 0:
		w //= 2
		c *= 2
	while h % 2 == 0:
		h //= 2
		c *= 2
	if c >= n:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(w, h, n) = map(int, input().split())
	t = 0
	while w % 2 == 0 and w != 0:
		t = t + 1
		w = w // 2
	while h % 2 == 0 and h != 0:
		t = t + 1
		h = h // 2
	x = 2 ** t
	if x >= n or n == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(w, h, n) = map(int, input().split())
	if n == 1:
		print('YES')
	else:
		ans = 0
		while w % 2 == 0:
			w = w // 2
			ans += 1
		while h % 2 == 0:
			h = h // 2
			ans += 1
		po = 2 ** ans
		if po >= n:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(0, t):
	(w, h, n) = list(map(int, input().split()))
	no_cards = 1
	while w % 2 == 0:
		no_cards *= 2
		w /= 2
	while h % 2 == 0:
		no_cards *= 2
		h /= 2
	if no_cards >= n:
		print('YES')
	else:
		print('NO')


for i in range(0, int(input())):
	(w, h, n) = map(int, input().split())
	k = 1
	wh = w * h
	while wh % 2 == 0:
		wh /= 2
		k *= 2
	if k >= n:
		print('YES')
	else:
		print('NO')


import sys
try:
	(sys.stdin, sys.stdout) = (open('in.txt', 'r'), open('out.txt', 'w'))
except:
	pass
ii1 = lambda : int(sys.stdin.readline().strip())
is1 = lambda : sys.stdin.readline().strip()
iia = lambda : list(map(int, sys.stdin.readline().strip().split()))
isa = lambda : sys.stdin.readline().strip().split()
mod = int(1000000000.0 + 7)
from collections import *
from math import *
for _ in range(ii1()):
	(w, h, n) = iia()
	count = 1
	while w > 1:
		if w % 2:
			break
		else:
			count *= 2
			w = w // 2
	while h > 1:
		if h % 2:
			break
		else:
			count *= 2
			h = h // 2
	if count == 1 and n == 1:
		print('YES')
	elif count == 1 and n >= 2:
		print('NO')
	elif count >= n:
		print('YES')
	else:
		print('NO')


for s in [*open(0)][1:]:
	(w, h, n) = map(int, s.split())
	print('YNEOS'[w * h & -w * h < n::2])


import os
import sys
from io import BytesIO, IOBase
from collections import deque, defaultdict, OrderedDict, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, insort, bisect_left
from functools import lru_cache
sys.setrecursionlimit(10 ** 6)

def STRIN():
	return input()

def INTIN():
	return int(input())

def LINT():
	return list(map(int, input().split()))

def LSTR():
	return list(map(str, input().split()))

def MINT():
	return map(int, input().split())

def MSTR():
	return map(str, input().split())

def main():
	for _ in range(INTIN()):
		(w, h, n) = MINT()
		c = 1
		if n == 1:
			print('YES')
		elif w % 2 != 0 and h % 2 != 0 and (n != 1):
			print('NO')
		else:
			while w % 2 == 0:
				w = w // 2
				c *= 2
			while h % 2 == 0:
				h = h // 2
				c *= 2
			if c >= n:
				print('YES')
			else:
				print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for i in range(t):
	whn = input().split()
	w = int(whn[0])
	h = int(whn[1])
	n = int(whn[2])
	counter = 1
	while w % 2 == 0:
		w //= 2
		counter *= 2
	while h % 2 == 0:
		h //= 2
		counter *= 2
	if n > counter:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	L = input().split()
	(L[0], L[1], L[2]) = (int(L[0]), int(L[1]), int(L[2]))
	x = L[0] * L[1]
	newvar = 0
	while x % 2 == 0:
		newvar += 1
		x /= 2
	if L[2] > 2 ** newvar:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	(w, h, n) = list(map(int, input().split()))
	(a, b) = (0, 0)
	while w % 2 == 0:
		a += 1
		w //= 2
	while h % 2 == 0:
		b += 1
		h //= 2
	if 2 ** (a + b) >= n:
		print('YES')
	else:
		print('NO')


import sys
from functools import lru_cache
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
T = int(input())

@lru_cache(None)
def rec(x):
	if x % 2:
		return 1
	return 2 * rec(x // 2)
for _ in range(T):
	(w, h, n) = map(int, input().split())
	ans = rec(w) * rec(h)
	if ans >= n:
		print('YES')
		continue
	print('NO')


for i in range(int(input())):
	count: int = 1
	index: int = 0
	ans: int = 0
	(a, b, c) = map(int, input().split())
	if a * b % 2 == 0:
		ans = a * b
		while ans % 2 == 0:
			count = count + 2 ** index
			ans = ans / 2
			index = index + 1
		if count >= c:
			print('YES')
		else:
			print('NO')
	elif count >= c:
		print('YES')
	else:
		print('NO')


def countFactors(n):
	pwr = 0
	while n > 0 and n % 2 == 0:
		n //= 2
		pwr += 1
	return 2 ** pwr
for i in range(int(input())):
	(w, h, n) = map(int, input().split())
	if w % 2 != 0 and h % 2 != 0:
		if n <= 1:
			print('YES')
		else:
			print('NO')
	else:
		if w % 2 == 0 and h % 2 != 0:
			k = countFactors(w)
		elif w % 2 != 0 and h % 2 == 0:
			k = countFactors(h)
		else:
			k = countFactors(h) * countFactors(w)
		if k >= n:
			print('YES')
		else:
			print('NO')


(a, d) = (int(input()), [])
for i in range(0, a):
	b = [int(i) for i in input().split()]
	(t1, t2) = (1, 1)
	while True:
		u = 0
		if b[0] % 2 == 0:
			b[0] //= 2
			t1 *= 2
			u = 1
		if b[1] % 2 == 0:
			b[1] //= 2
			t2 *= 2
			u = 1
		if u == 0:
			break
	if t1 * t2 >= b[2]:
		d.append('YES')
	else:
		d.append('NO')
print(*d, sep='\n')


def max_t(num):
	count = 0
	while num % 2 == 0:
		count += 1
		num //= 2
	return count
t = int(input())
out = []
for i in range(t):
	(w, h, n) = map(int, input().split())
	if 2 ** (max_t(w) + max_t(h)) >= n:
		out.append('YES')
	else:
		out.append('NO')
print('\n'.join(out))


from sys import stdin
from sys import stdout
from math import *
import sys
input = stdin.readline
for __ in range(int(input())):
	(n, m, x) = map(int, input().split())
	ans = 1
	while n % 2 == 0 or m % 2 == 0:
		if n % 2 == m % 2 == 0:
			ans = ans * 4
			n = n // 2
			m = m // 2
		elif n % 2 == 0:
			ans = ans * 2
			n = n // 2
		elif m % 2 == 0:
			ans = ans * 2
			m = m // 2
	if ans >= x:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(w, h, f) = [int(i) for i in input().split()]
	c = 1
	while w % 2 == 0 or h % 2 == 0:
		if w % 2 == 0:
			w //= 2
			c += 1 * c
		else:
			h //= 2
			c += 1 * c
	if f > c:
		print('no')
	else:
		print('yes')


t = int(input())
for _ in range(t):
	[w, h, n] = [int(x) for x in input().split()]
	npieces = 1
	while w % 2 == 0:
		w = w // 2
		npieces = npieces * 2
	while h % 2 == 0:
		h = h // 2
		npieces = npieces * 2
	if npieces >= n:
		print('YES')
	else:
		print('NO')


for T in range(int(input())):
	(w, h, n) = map(int, input().split())
	(p1, p2) = (0, 0)
	while w % 2 == 0:
		p1 += 1
		w //= 2
	while h % 2 == 0:
		p2 += 1
		h //= 2
	print('YES' if 2 ** p1 * 2 ** p2 >= n else 'NO')


t = int(input())
for i in range(0, t):
	(w, h, n) = map(int, input().split())
	c = 1
	while w % 2 == 0:
		w = w // 2
		c = c * 2
		if c == n:
			break
		if w % 2 != 0:
			break
	while h % 2 == 0:
		h = h // 2
		c = c * 2
		if c == n:
			break
		if h % 2 != 0:
			break
	if c >= n or n == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
result = [1] * t
for i in range(t):
	list1 = list(map(int, input().split(' ')))
	(a, b, n) = (int(list1[0]), int(list1[1]), int(list1[2]))
	box = [a, b]
	p = a * b
	while n > 1:
		if p % 2 == 0:
			p = p // 2
			n = (n + 1) // 2
		else:
			result[i] = 0
			break
for i in result:
	print('YES') if i == 1 else print('NO')


def solve(w, h, n):
	pieces = 1
	while w % 2 == 0 or h % 2 == 0:
		if w % 2 == 0:
			w = w // 2
			pieces *= 2
		elif h % 2 == 0:
			h = h // 2
			pieces *= 2
	return 'YES' if pieces >= n else 'NO'

def main():
	test_cases = input()
	for _ in range(int(test_cases)):
		(w, h, n) = map(int, input().split())
		print(solve(w, h, n))
main()


t = int(input())
for i in range(t):
	(w, h, n) = map(int, input().split())
	if w * h & -w * h < n:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	count = 1
	d = 0
	k = 0
	e = 0
	(h, w, n) = map(int, input().split())
	if (h % 2 == 1 and w % 2 == 1) and n != 1:
		print('NO')
	if n == 1:
		print('YES')
	if (h % 2 == 0 and w % 2 == 1) and n != 1:
		while h % 2 != 1:
			h = h / 2
			count *= 2
		if count >= n:
			print('YES')
		else:
			print('NO')
	if (h % 2 == 1 and w % 2 == 0) and n != 1:
		while w % 2 != 1:
			w = w / 2
			count *= 2
		if count >= n:
			print('YES')
		else:
			print('NO')
	if (h % 2 == 0 and w % 2 == 0) and n != 1:
		while w % 2 != 1:
			w = w / 2
			count *= 2
		while h % 2 != 1:
			h = h / 2
			count *= 2
		if count >= n:
			print('YES')
		else:
			print('NO')


def number_papers():
	(w, h, n) = input().split()
	w = int(w)
	h = int(h)
	n = int(n)
	count1 = 1
	count2 = 1
	while w % 2 == 0:
		count1 *= 2
		w = w / 2
	while h % 2 == 0:
		count2 *= 2
		h = h / 2
	res = count1 * count2
	if res < n:
		return 'NO'
	return 'YES'
no_tests = int(input())
res = []
for i in range(no_tests):
	res.append(number_papers())
for each in res:
	print(each)


import sys
for n in range(int(sys.stdin.readline())):
	w_h_n = sys.stdin.readline().strip().split(' ')
	product = int(w_h_n[0]) * int(w_h_n[1])
	power = 0
	while product % 2 == 0:
		power += 1
		product = product / 2
	if 2 ** power >= int(w_h_n[2]):
		print('YES')
	else:
		print('NO')


import math
T = int(input())
for tc in range(T):
	(w, h, n) = map(int, input().split())
	s = w * h
	c = 1
	while s % 2 == 0:
		s /= 2
		c *= 2
	print('YES' if c >= n else 'NO')


from sys import stdin
input = stdin.readline

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def pow2(n):
	c = 1
	while n % 2 == 0:
		n //= 2
		c *= 2
	return c
for _ in range(ii()):
	(w, h, n) = li()
	if pow2(w) * pow2(h) >= n:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	input_data = input()
	input_data_list = input_data.split(' ')
	count = 1
	n = int(input_data_list[2])
	m = int(input_data_list[0])
	h = int(input_data_list[1])
	if n == 1:
		print('YES')
	else:
		while m % 2 == 0 or count == n:
			m /= 2
			count *= 2
		while h % 2 == 0 or count == n:
			count *= 2
			h /= 2
		if count >= n:
			print('YES')
		else:
			print('NO')


t = int(input())
for _ in range(t):
	(w, h, n) = map(int, input().split())
	totw = 1
	while w % 2 == 0:
		w >>= 1
		totw *= 2
	toth = 1
	while h % 2 == 0:
		h >>= 1
		toth *= 2
	if totw * toth >= n:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(w, h, n) = tuple(map(int, input().split()))
	ww = 1
	while w % 2 == 0:
		ww *= 2
		w //= 2
	hh = 1
	while h % 2 == 0:
		hh *= 2
		h //= 2
	if ww * hh >= n:
		print('YES')
	else:
		print('NO')


strng = lambda : input()
inp = lambda : int(input())
mul = lambda : map(int, input().split())
jn = lambda x, l: x.join(map(str, l))
strlst = lambda : list(input())
lst = lambda : list(map(int, input().split()))
dd = lambda : defaultdict(lambda : 0)
import sys
input = sys.stdin.readline
from collections import defaultdict
from math import ceil, log, floor, sqrt, gcd, log10
for _ in range(inp()):
	(w, h, n) = mul()
	cnt = 1
	hc = 1
	while True:
		if not h & 1:
			h = h // 2
			cnt += hc
			hc += hc
		if not w & 1:
			w = w // 2
			cnt += hc
			hc += hc
		if w & 1 and h & 1:
			break
	if cnt >= n:
		print('YES')
		continue
	print('NO')


for i in range(int(input())):
	(w, h, k) = map(int, input().split())
	c = v = 1
	if k == 1:
		print('YES')
	else:
		a = w * h
		while a % 2 == 0:
			a = a // 2
			c *= 2
		if c >= k:
			print('YES')
		else:
			print('NO')


f = lambda x: bin(x)[::-1].find('1')
for s in [*open(0)][1:]:
	(w, h, n) = map(int, s.split())
	print('YNEOS'[1 << f(w) + f(h) < n::2])


def solve():
	for _ in range(ii()):
		(w, h, n) = mi()
		c = 1
		while w % 2 == 0 or h % 2 == 0:
			if w % 2 == 0:
				c *= 2
				w /= 2
			elif h % 2 == 0:
				c *= 2
				h /= 2
		print('YES' if n <= c else 'NO')
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : input()
solve()


t = int(input())
for i in range(t):
	(a, b, c) = [int(x) for x in input().split()]
	res = 0
	while a % 2 == 0:
		a //= 2
		res += 1
	while b % 2 == 0:
		b //= 2
		res += 1
	if 2 ** res >= c:
		print('YES')
	else:
		print('NO')


import math
import collections

def solve(w, h, n):
	twos = 0
	while w % 2 == 0:
		twos += 1
		w /= 2
	while h % 2 == 0:
		twos += 1
		h /= 2
	if 2 ** twos >= n:
		return 'YES'
	else:
		return 'NO'
t = int(input())
for t in range(t):
	(w, h, n) = [int(s) for s in input().split()]
	result = solve(w, h, n)
	print(result)


def sol(w, h, n):
	count = 1
	A = w * h
	while A % 2 != 1:
		A = A // 2
		count = count * 2
	if count >= n:
		return 'YES'
	return 'NO'
t = int(input())
for _ in range(t):
	(w, h, n) = map(int, input().split())
	print(sol(w, h, n))


def solve(w, h, n):
	result = 1
	while w % 2 == 0:
		w //= 2
		result *= 2
	while h % 2 == 0:
		h //= 2
		result *= 2
	if result >= n:
		return 'YES'
	else:
		return 'NO'
t = int(input())
for i in range(t):
	(w, h, n) = list(map(int, input().split()))
	print(solve(w, h, n))


def check(w, h):
	c = 1
	while w % 2 == 0:
		c = c * 2
		w = w / 2
	while h % 2 == 0:
		c = c * 2
		h = h / 2
	return c
t = int(input())
for i in range(t):
	(w, h, n) = map(int, input().split())
	ans = check(w, h)
	if ans >= n:
		print('YES')
	else:
		print('NO')


def val(n):
	c = 1
	while n % 2 == 0:
		c *= 2
		n = n / 2
	return c
no = int(input())
for i in range(no):
	temp = input().split()
	w = int(temp[0])
	h = int(temp[1])
	n = int(temp[2])
	if w % 2 != 0 and h % 2 != 0:
		if n == 1:
			print('YES')
		else:
			print('NO')
	else:
		if w % 2 == 0 and h % 2 == 0:
			t1 = val(w)
			c = t1 * val(h)
		elif h % 2 == 0 and w % 2 != 0:
			c = val(h)
		elif w % 2 == 0 and h % 2 != 0:
			c = val(w)
		if n <= c:
			print('YES')
		else:
			print('NO')


t = int(input())
while t > 0:
	(w, h, n) = map(int, input().split())
	cnt = 0
	while w % 2 == 0:
		cnt += 1
		w = w // 2
	while h % 2 == 0:
		cnt += 1
		h = h // 2
	if 2 ** cnt >= n:
		print('YES')
	else:
		print('NO')
	t -= 1


for i in range(int(input())):
	(w, h, n) = [int(j) for j in input().split()]
	bo = False
	co = 0
	while True:
		if w % 2 == 0:
			w //= 2
			co += 1
		elif h % 2 == 0:
			h //= 2
			co += 1
		else:
			break
	if pow(2, co) >= n or n == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(w, h, n) = map(int, input().split())
	rez = 1
	while w % 2 == 0:
		w = w / 2
		rez = rez * 2
	while h % 2 == 0:
		h = h / 2
		rez = rez * 2
	if rez >= n:
		print('yes')
	else:
		print('no')


for T in range(int(input())):
	(w, h, n) = map(int, input().split())
	print('NO' if (w & -w) * (h & -h) < n else 'YES')


def rd2(n):
	rez = 1
	while True:
		if n % 2 == 0:
			n //= 2
			rez += 1
		else:
			ot = 1
			for i in range(1, rez):
				ot *= 2
			return ot
t = int(input())
for i in range(t):
	(w, h, n) = input().split()
	(w, h, n) = (int(w), int(h), int(n))
	if rd2(w) * rd2(h) >= n:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(w, h, n) = map(int, input().split())
	value = w * h & -w * h
	if value >= n:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(w, h, n) = list(map(int, input().strip().split()))[:3]
	if n == 1:
		print('YES')
		continue
	x = w * h
	cou = 0
	while x % 2 == 0:
		x = x // 2
		cou += 1
	if 2 ** cou >= n:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, m, c) = list(map(int, input().split()))

	def count(n, m):
		if n % 2 != 0 and m % 2 != 0:
			return 1
		if m == 1 and n == 1:
			return 1
		if m % 2 == 0:
			return 2 * count(n, m // 2)
		if n % 2 == 0:
			return 2 * count(n // 2, m)
	ans = count(n, m)
	if ans >= c:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	c = 1
	while b % 2 == 0:
		c *= 2
		b = b / 2
	while a % 2 == 0:
		c *= 2
		a = a / 2
	print('YES') if n <= c else print('NO')


t = int(input())
res = ['XZ' for _ in range(0, t)]
for _ in range(0, t):
	(w, h, n) = map(int, input().split())
	amPaper = 1
	while w % 2 == 0 or h % 2 == 0:
		if w % 2 == 0:
			w //= 2
		else:
			h //= 2
		amPaper *= 2
	if amPaper >= n:
		res[_] = 'Yes'
	else:
		res[_] = 'No'
for i in range(0, t):
	print(res[i])


def cuttable(w, h, n):
	res = 1
	while w % 2 == 0 and w > 0:
		w = w / 2
		res = res * 2
	while h % 2 == 0 and h > 0:
		h = h / 2
		res = res * 2
	return res >= n

def main():
	p = int(input())
	for i in range(p):
		(w, h, n) = [int(_) for _ in input().split()]
		print('yes') if cuttable(w, h, n) else print('no')
main()


t = int(input())
for i in range(t):
	ans = 1
	x = list(map(int, input().split()))
	while int(x[0]) % 2 == 0 or int(x[1]) % 2 == 0:
		if int(x[0]) % 2 == 0:
			x[0] = int(x[0]) / 2
			ans *= 2
		if int(x[1]) % 2 == 0:
			x[1] = int(x[1]) / 2
			ans *= 2
	if ans >= int(x[2]):
		print('YES')
	else:
		print('NO')


import math
n = int(input())
for _ in range(n):
	(w, h, n) = map(int, input().split())
	val = 1
	while w % 2 == 0:
		w /= 2
		val *= 2
	while h % 2 == 0:
		h /= 2
		val *= 2
	r = 'YES' if val >= n else 'NO'
	print(r)


t = int(input())
a = []

def Input(w, h, n):
	count = 1
	while w % 2 == 0:
		w = w / 2
		count = count * 2
	while h % 2 == 0:
		h = h / 2
		count = count * 2
	if count >= n:
		a.append('YES')
	else:
		a.append('NO')
	count = 1
for i in range(t):
	(w, h, n) = map(int, input().split())
	Input(w, h, n)
for i in range(t):
	print(a[i])


n = 0
num = int(input(''))
empty = []
while n < num:
	arr = list(map(int, input('').split()))
	area = arr[0] * arr[1]
	count = 1
	while area % 2 == 0:
		count = count * 2
		area = area / 2
	if count >= arr[2]:
		empty.append('YES')
	else:
		empty.append('NO')
	n += 1
for i in empty:
	print(i)


def check(w, h, n):
	res = 1
	while w % 2 == 0:
		res *= 2
		w //= 2
	while h % 2 == 0:
		res *= 2
		h //= 2
	print('YNEOS'[res < n::2])
for _ in range(int(input())):
	check(*map(int, input().split()))


t = input()
t = int(t)
for i in range(0, t):
	(w, h, n) = input().split()
	w = int(w)
	h = int(h)
	n = int(n)
	x = 1
	while int(h % 2) == 0:
		x *= 2
		h = h / 2
	while int(w % 2) == 0:
		w = w / 2
		x *= 2
	if n <= x:
		print('YES')
	elif n == 1:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	(w, h, n) = invr()
	curr = 1
	while w % 2 == 0:
		curr *= 2
		w //= 2
	while h % 2 == 0:
		h //= 2
		curr *= 2
	if curr >= n:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	(W, H, N) = map(int, input().split())
	Wcnt = 1
	Hcnt = 1
	while W > 1:
		if W % 2 == 0:
			W = W // 2
			Wcnt *= 2
		else:
			break
	while H > 1:
		if H % 2 == 0:
			H = H // 2
			Hcnt *= 2
		else:
			break
	if Hcnt * Wcnt >= N:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(w, h, n) = map(int, input().split())
	paper = 1
	while w % 2 == 0:
		paper = paper * 2
		w = int(w / 2)
	while h % 2 == 0:
		paper = paper * 2
		h = int(h / 2)
	if paper > n:
		print('YES')
	elif paper < n:
		print('NO')
	elif paper == n:
		print('YES')


for _ in range(int(input())):
	(w, h, n) = map(int, input().split())
	f = 1
	ans = 1
	while f == 1:
		if w % 2 == 0:
			w = w // 2
			ans = ans * 2
		if h % 2 == 0:
			h = h // 2
			ans = ans * 2
		if w % 2 != 0 and h % 2 != 0:
			f = 0
	if ans >= n:
		print('YES')
	else:
		print('NO')


z = int(input())
for q in range(z):
	c = 1
	(w, h, n) = [int(x) for x in input().split()]
	while w % 2 == 0 or h % 2 == 0:
		if w % 2 == 0:
			w = w // 2
			c = c * 2
		if h % 2 == 0:
			h = h // 2
			c = c * 2
	if c >= n:
		print('YES')
	else:
		print('NO')


def solve():
	(w, h, r) = map(int, input().split(' '))
	cnt = 0
	if w % 2 == 0:
		while w % 2 == 0:
			w = w // 2
			cnt = cnt + 1
	if h % 2 == 0:
		while h % 2 == 0:
			h = h // 2
			cnt = cnt + 1
	x = pow(2, cnt)
	if x >= r:
		print('YES')
	else:
		print('NO')
t = int(input())
while t != 0:
	solve()
	t = t - 1


def solve():
	(w, h, n) = map(int, input().split())
	a = 1
	b = 1
	while w % 2 == 0:
		w /= 2
		a *= 2
	while h % 2 == 0:
		h /= 2
		b *= 2
	if n <= a * b:
		print('YES')
	else:
		print('NO')
t = 1
t = int(input())
for i in range(t):
	solve()


def algo(_p):
	paper = 1
	while paper < _p[2]:
		if _p[0] % 2 == 0:
			_p[0] /= 2
			paper += paper
		elif _p[1] % 2 == 0:
			_p[1] /= 2
			paper += paper
		else:
			return 'no'
	return 'yes'
n = int(input())
while n > 0:
	n -= 1
	p = p = list(map(int, input().split(' ', 3)))
	print(algo(p))


num = int(input())
outputs = []
for i in range(0, num):
	list1 = input().split(' ')
	(w, h, n) = (int(list1[0]), int(list1[1]), int(list1[2]))
	hpieces = 1
	while h % 2 == 0:
		h /= 2
		hpieces *= 2
	wpieces = 1
	while w % 2 == 0:
		w /= 2
		wpieces *= 2
	if hpieces * wpieces >= n:
		outputs.append('YES')
	else:
		outputs.append('NO')
for j in outputs:
	print(j)


import sys, math
wtf = sys.stdin.read()
wtf = wtf.strip().split('\n')
T = int(wtf[0])
assert T >= 1 and T <= int(10000.0), 'Precondition failure'
for t in wtf[1:]:
	(w, h, n) = map(int, t.split())
	ans = 1
	while ans < n and (w != 0 or h != 0):
		if w % 2 == 0:
			w //= 2
			ans *= 2
		elif h % 2 == 0:
			h //= 2
			ans *= 2
		else:
			break
	print('YES' if ans >= n else 'NO')


for _ in range(int(input())):
	(w, h, n) = map(int, input().split())
	bw = bin(w)[2:]
	bh = bin(h)[2:]
	(cw, ch) = (0, 0)
	for i in range(len(bw) - 1, -1, -1):
		if bw[i] == '1':
			break
		cw = cw + 1
	for i in range(len(bh) - 1, -1, -1):
		if bh[i] == '1':
			break
		ch = ch + 1
	if ch == 0 and cw == 0:
		res = 1
	elif ch == 0:
		res = 2 ** cw
	elif cw == 0:
		res = 2 ** ch
	else:
		res = 2 ** ch * 2 ** cw
	if n <= res:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(w, h, n) = map(int, input().split())
	u = 1
	if w % 2 == 1 and h % 2 == 1:
		if n > 1:
			print('NO')
		else:
			print('YES')
	else:
		while w % 2 == 0:
			w = w // 2
			u *= 2
		while h % 2 == 0:
			h = h // 2
			u *= 2
		if u >= n:
			print('YES')
		else:
			print('NO')


num = int(input())
for i in range(num):
	k = 1
	m = 1
	(w, h, t) = map(int, input().rstrip().split())
	if w % 2 != 0 and h % 2 != 0 and (t > 1):
		print('NO')
	elif w % 2 != 0 and h % 2 != 0 and (t == 1):
		print('YES')
	else:
		while w % 2 == 0 or h % 2 == 0:
			if w % 2 == 0:
				k *= 2
				w = int(w / 2)
				m += 1
			if h % 2 == 0:
				k *= 2
				h = int(h / 2)
				m += 1
		if k >= t:
			print('YES')
		else:
			print('NO')


import math
for _ in range(int(input())):
	(w, h, n) = map(int, input().split())
	a = 0
	b = 0
	while w % 2 == 0:
		w = w // 2
		a += 1
	while h % 2 == 0:
		h = h // 2
		b += 1
	t = math.ceil(math.log(n, 2))
	if t <= a + b:
		print('YES')
	else:
		print('NO')


def solve(w: int, h: int, n: int) -> str:
	(h_cuts, w_cuts) = (0, 0)
	while h % 2 == 0:
		h //= 2
		h_cuts += 1
	while w % 2 == 0:
		w //= 2
		w_cuts += 1
	papers = 2 ** h_cuts * 2 ** w_cuts
	return 'YES' if papers >= n else 'NO'
tests = int(input())
for _ in range(tests):
	(w, h, n) = map(int, input().split(' '))
	res = solve(w, h, n)
	print(res)


import sys

def cardsForFriends():
	for _ in range(int(input())):
		(w, h, n) = map(int, input().split())
		(ans, tmp) = (1, 1)
		while not w & 1:
			w //= 2
			ans += tmp
			tmp *= 2
		while not h & 1:
			h //= 2
			ans += tmp
			tmp *= 2
		if ans >= n:
			print('YES')
		else:
			print('NO')

def main():
	cardsForFriends()
main()


t = int(input())
for _ in range(t):
	(w, h, n) = map(int, input().split())
	w1 = 1
	while w % 2 == 0:
		w /= 2
		w1 *= 2
	h1 = 1
	while h % 2 == 0:
		h /= 2
		h1 *= 2
	if w1 * h1 >= n:
		print('YES')
	else:
		print('NO')


def splitter(D, Dans):
	while D % 2 == 0:
		D /= 2
		Dans *= 2
	return Dans
t = int(input())
for i in range(t):
	(w, h, n) = map(int, input().split())
	if n == 1:
		print('YES')
		continue
	ans = 1
	ans = splitter(w, ans)
	if ans >= n:
		print('YES')
		continue
	if splitter(h, ans) >= n:
		print('YES')
		continue
	print('NO')


import sys
sys.setrecursionlimit(10 ** 6)
from sys import stdin, stdout
import math
from collections import defaultdict, Counter, deque
from functools import lru_cache
import bisect
from heapq import heapify, heappush, heappop
from itertools import permutations, combinations
mod = 10 ** 9 + 7
inf = math.inf

@lru_cache(None)
def get_max(w, h):
	if w == 0 or h == 0:
		return 0
	ans = 1
	if w % 2 == 0:
		ans = max(ans, 2 * get_max(w // 2, h))
	if h % 2 == 0:
		ans = max(ans, 2 * get_max(w, h // 2))
	return ans

def solve(w, h, n):
	if get_max(w, h) >= n:
		return 'YES'
	return 'NO'
t = int(input())
for _ in range(t):
	line = stdin.readline()
	(w, h, n) = map(int, line.split(' '))
	print(solve(w, h, n))


def get_power_of_two(x):
	power_of_two = 0
	while x > 1:
		if x % 2 == 1:
			break
		x //= 2
		power_of_two += 1
	return 2 ** power_of_two
cases = int(input().strip())
for case in range(cases):
	(w, h, n) = [int(x) for x in input().strip().split(' ')]
	if get_power_of_two(w) * get_power_of_two(h) >= n:
		print('YES')
	else:
		print('NO')


def can_cut(width: int, height: int, cuts: int, parts: int=1) -> bool:
	while not width % 2:
		(parts, width) = (parts * 2, width // 2)
	while not height % 2:
		(parts, height) = (parts * 2, height // 2)
	return parts >= cuts

def read_input(filename: str=None) -> None:
	from sys import stdin
	stdin = open(filename) if filename else stdin
	cases = int(stdin.readline())
	while cases:
		cases = cases - 1
		(width, height, cuts) = tuple(map(int, stdin.readline().split()))
		print('YES') if can_cut(width, height, cuts) else print('NO')

def main():
	read_input()
main()


for _ in range(int(input())):
	(w, h, n) = map(int, input().split())
	print('YNEOS'[w * h & -w * h < n::2])


for _ in range(int(input())):
	(w, h, n) = map(int, input().split())
	if n == 1:
		print('YES')
	elif w % 2 != 0 and h % 2 != 0:
		print('NO')
	else:
		j = 1
		while w % 2 == 0:
			j = j * 2
			w = w // 2
		while h % 2 == 0:
			j = j * 2
			h = h // 2
		if j >= n:
			print('YES')
		else:
			print('NO')


import math
s = []
for i in range(int(input())):
	(w, h, n) = map(int, input().split())
	if n == 1:
		s.append('YES')
	elif w % 2 != 0 and h % 2 != 0:
		s.append('NO')
	else:
		i = int(math.log(w * h, 2))
		while i > 0:
			if w * h % 2 ** i == 0:
				if 2 ** i >= n:
					s.append('YES')
				else:
					s.append('NO')
				break
			i = i - 1
for j in range(len(s)):
	print(s[j])


for _ in range(int(input())):
	(w, h, n) = map(int, input().split())
	cnt1 = 1
	cnt2 = 1
	ww = w
	hh = h
	while ww % 2 == 0:
		cnt1 *= 2
		ww /= 2
	while hh % 2 == 0:
		cnt2 *= 2
		hh //= 2
	if cnt1 * cnt2 >= n:
		print('YES')
	else:
		print('NO')


a = int(input())
b = 0
while b < a:
	c = input().split(' ')
	d = int(c[0]) * int(c[1])
	e = int(c[2])
	f = 1
	while d % 2 == 0:
		d = d // 2
		f = f * 2
	if f >= e:
		print('YES')
	else:
		print('NO')
	b = b + 1


t = int(input())
while t:
	(w, h, n) = list(map(int, input().split()))
	p = 0
	while w % 2 == 0 and w > 1:
		p += 1
		w = w // 2
	while h % 2 == 0 and h > 1:
		p += 1
		h = h // 2
	if 2 ** p >= n:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	(x, y) = (1, 1)
	while a % 2 == 0:
		a //= 2
		x *= 2
	while b % 2 == 0:
		b //= 2
		x *= 2
	if x >= c:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(w, h, n) = map(int, input().split())
	count = 1
	if w % 2 == 1 and h % 2 == 1:
		if count >= n:
			print('YES')
		else:
			print('NO')
	else:
		i = 0
		while w > 0 and h > 0:
			if count >= n:
				print('YES')
				break
			elif w % 2 == 0:
				count = count * 2
				w = w // 2
			elif h % 2 == 0:
				count = count * 2
				h = h // 2
			elif w % 2 == 1 and h % 2 == 1:
				if count >= n:
					print('YES')
				else:
					print('NO')
				break


res = ''
for _ in range(int(input())):
	(w, h, n) = map(int, input().split())
	x = 0
	while not w & 1 or not h & 1:
		if not w & 1:
			w //= 2
			x += 1
		if not h & 1:
			h //= 2
			x += 1
		if 2 ** x >= n:
			break
	res += ('NO\n', 'YES\n')[2 ** x >= n]
print(res)


from sys import stdin

def A():
	t = int(stdin.readline())
	while t:
		t -= 1
		a = [int(x) for x in stdin.readline().split()]
		(w, h, n) = (a[0], a[1], a[2])
		cnt = 1
		cnt1 = 1
		while w % 2 == 0:
			w /= 2
			cnt *= 2
		while h % 2 == 0:
			h /= 2
			cnt1 *= 2
		if cnt * cnt1 >= n:
			print('YES')
		else:
			print('NO')
A()


t = int(input())
while t > 0:
	t = t - 1
	(n, m, x) = map(int, input().split())
	ans = 1
	while n % 2 == 0:
		ans *= 2
		n /= 2
	while m % 2 == 0:
		ans *= 2
		m /= 2
	if ans >= x:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, x) = map(int, input().split())
	ans = 1
	while a % 2 == 0 or b % 2 == 0:
		if a % 2 == 0 and b % 2 == 0:
			ans = ans * 4
			b //= 2
			a //= 2
		elif a % 2 == 0:
			ans = ans * 2
			a //= 2
		elif b % 2 == 0:
			ans = ans * 2
			b //= 2
	if ans >= x:
		print('YES')
	else:
		print('NO')


K = int(input())
for G in range(0, K):
	(a, b, c) = map(int, input().split())
	k = 1
	for i in range(0, c):
		if k >= c:
			break
		elif a % 2 == 0:
			k *= 2
			a /= 2
		elif b % 2 == 0:
			k *= 2
			b /= 2
		else:
			break
	if k >= c:
		print('YES')
	else:
		print('NO')


t = int(input())
ans = []
while t != 0:
	t -= 1
	(a, b, c) = tuple(map(int, input().split()))
	count = 1
	while a % 2 == 0:
		a = a // 2
		count *= 2
	while b % 2 == 0:
		b = b // 2
		count *= 2
	if count >= c:
		ans.append('YES')
	else:
		ans.append('NO')
for i in ans:
	print(i)


def oxxy(x):
	j = 1
	while x % 2 ** j == 0:
		j += 1
	return 2 ** (j - 1)
t = int(input())
for i in range(t):
	(w, h, n) = map(int, input().split())
	if oxxy(w) * oxxy(h) >= n:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = 1
	while 1:
		if a % 2 == 0:
			a = a / 2
			ans *= 2
		elif b % 2 == 0:
			b = b / 2
			ans *= 2
		else:
			break
	if ans >= c:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(w, h, n) = map(int, input().split())
	m = w * h
	c = 0
	while m % 2 == 0:
		m = m // 2
		c += 1
	if 2 ** c >= n:
		print('Yes')
	else:
		print('No')


def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def MAP2():
	return map(float, input().split())

def LIST():
	return list(map(int, input().split()))

def STRING():
	return input()
import string
import sys
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter
from math import *
from itertools import permutations, accumulate
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
for tt in range(INT()):
	(x, y, n) = MAP()
	if n == 1:
		print('YES')
	else:
		cnt1 = 1
		while x % 2 == 0:
			x //= 2
			cnt1 *= 2
		while y % 2 == 0:
			y //= 2
			cnt1 *= 2
		if cnt1 >= n:
			print('YES')
		else:
			print('NO')


import functools

@functools.lru_cache(maxsize=None)
def get_max_cuts(w, h):
	if w % 2 == 0 and h % 2 == 0:
		return max(2 * get_max_cuts(w // 2, h), 2 * get_max_cuts(w, h // 2))
	elif w % 2 == 0:
		return 2 * get_max_cuts(w // 2, h)
	elif h % 2 == 0:
		return 2 * get_max_cuts(w, h // 2)
	else:
		return 1

def can_cut(w, h, n):
	return get_max_cuts(w, h) >= n
t = int(input())
for t_i in range(t):
	(w, h, n) = map(int, input().split())
	print('YES' if can_cut(w, h, n) else 'NO')


t = int(input())
for _ in range(t):
	(w, h, n) = [int(i) for i in input().split()]
	if n == 1:
		print('YES')
		continue
	count = 1
	while w % 2 == 0:
		count *= 2
		w //= 2
	while h % 2 == 0:
		count *= 2
		h //= 2
	if count >= n:
		print('YES')
	else:
		print('NO')


t = int(input())
for t in range(t):
	(m, n, k) = map(int, input().split())
	d = 1
	while m % 2 == 0 and m > 0:
		d = d * 2
		m = m // 2
	while n % 2 == 0 and n > 0:
		d = d * 2
		n = n // 2
	if d >= k:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(w, h, n) = [int(i) for i in input().split()]
	maxw2 = 0
	maxh2 = 0
	while w % 2 == 0:
		w //= 2
		maxw2 += 1
	while h % 2 == 0:
		h //= 2
		maxh2 += 1
	if 2 ** maxw2 * 2 ** maxh2 >= n:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	total = 1
	if c == 1:
		print('YES')
	elif (a % 2 != 0 and b % 2 != 0) and c > 1:
		print('NO')
	else:
		z = a * b
		for _ in range(max(a, b)):
			if z % 2 == 0:
				z = z // 2
				total *= 2
			else:
				break
		if total >= c:
			print('YES')
		else:
			print('NO')


T = int(input())
for i in range(T):
	(w, h, n) = map(int, input().split())
	wi = 0
	while w % 2 == 0:
		w = w // 2
		wi += 1
	hi = 0
	while h % 2 == 0:
		h = h // 2
		hi += 1
	if 2 ** wi * 2 ** hi >= n:
		print('YES')
	else:
		print('NO')


def solve(w, h, n):
	sheet = 1
	while sheet < n:
		if w % 2 == 0:
			w = w / 2
			sheet *= 2
		if h % 2 == 0:
			h = h / 2
			sheet *= 2
		if w % 2 != 0 and h % 2 != 0:
			break
	if sheet >= n:
		result = 'YES'
	else:
		result = 'NO'
	return result
t = int(input())
r = []
for i in range(t):
	debai = input().split()
	w = int(debai[0])
	h = int(debai[1])
	n = int(debai[2])
	r = solve(w, h, n)
	print(r)


from math import gcd
for _ in range(int(input())):
	(h, w, n) = map(int, input().split())
	print('YES' if gcd(h * w, 2 ** 30) >= n else 'NO')


for _ in range(int(input())):
	(h, w, n) = [int(x) for x in input().split()]
	(res1, res2) = (0, 0)
	while h % 2 == 0:
		res1 += 1
		h = h // 2
	while w % 2 == 0:
		res2 += 1
		w = w // 2
	if 2 ** (res1 + res2) >= n:
		print('Yes')
	else:
		print('No')


t = input()
t = int(t)
while t > 0:
	inp = list(map(int, input().split()))
	res = 1
	while inp[0] % 2 == 0:
		res *= 2
		inp[0] /= 2
	while inp[1] % 2 == 0:
		res *= 2
		inp[1] /= 2
	if res >= inp[2]:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for i in range(t):
	(w, h, n) = map(int, input().split())
	if n == 1:
		print('YES')
		continue
	ans = 1
	while w % 2 == 0:
		w /= 2
		ans *= 2
	while h % 2 == 0:
		h /= 2
		ans *= 2
	if ans >= n:
		print('YES')
		continue
	print('NO')


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(w, h, n) = map(int, sys.stdin.readline().split())
	cnt = 1
	size = w * h
	while size > 0 and size & 1 == False:
		size //= 2
		cnt *= 2
	if cnt >= n:
		print('YES')
	else:
		print('NO')


def f(width, height, numberOfPieces):
	count = 1
	while width % 2 == 0:
		count = count * 2
		width = width // 2
	while height % 2 == 0:
		count = count * 2
		height = height // 2
	return 'YES' if count >= numberOfPieces else 'NO'
result = []
testCases = int(input())
for idx in range(testCases):
	(width, height, numberOfPieces) = [int(item) for item in input().split(' ')]
	result.append(f(width, height, numberOfPieces))
for item in result:
	print(item)


for test in range(int(input())):
	(w, h, n) = list(map(int, input().split()))
	amount = 1
	while w % 2 == 0:
		w //= 2
		amount *= 2
	while h % 2 == 0:
		h //= 2
		amount *= 2
	if amount >= n:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(w, h, n) = map(int, input().split())
	p = 1
	while w % 2 == 0 or h % 2 == 0:
		if w % 2 == 0:
			p = 2 * p
			w = w / 2
		elif h % 2 == 0:
			p = 2 * p
			h = h / 2
	if p >= n:
		print('yes')
	else:
		print('no')


def solve():
	(w, h, n) = map(int, input().split())
	ans = 1
	for x in [w, h]:
		while x % 2 == 0:
			ans *= 2
			x //= 2
	if ans >= n:
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	solve()


t = int(input())
rlist = []

def getcount(w, h, memory={}):
	if (w, h) in memory:
		return memory[w, h]
	if w % 2 == 0:
		value = 2 * getcount(w / 2, h)
		memory[w, h] = value
		return value
	elif h % 2 == 0:
		value = 2 * getcount(w, h / 2)
		memory[w, h] = value
		return value
	return 1
for _ in range(t):
	(w, h, n) = list(map(int, input().split(' ')))
	count = getcount(w, h)
	if count >= n:
		rlist.append('YES')
	else:
		rlist.append('NO')
for i in rlist:
	print(i)


t = int(input())
result = []
for i in range(0, t):
	(w, h, n) = [int(s) for s in input().split()]
	sheet = 1
	while sheet <= n:
		if n == 1:
			result.append('YES')
			break
		elif w % 2 == 0:
			w = w / 2
			sheet *= 2
			if sheet >= n:
				result.append('YES')
				break
		elif h % 2 == 0:
			h = h / 2
			sheet *= 2
			if sheet >= n:
				result.append('YES')
				break
		else:
			result.append('NO')
			break
print('\n'.join(result))


for i in range(int(input())):
	(width, height, req) = map(int, input().split())
	prod = width * height
	count = 1
	while prod % 2 == 0:
		prod = prod // 2
		count *= 2
	if count >= req:
		print('YES')
	else:
		print('NO')


def power2(x):
	t = 0
	while x % 2 == 0:
		t += 1
		x //= 2
	return t
for _ in [*open(0)][1:]:
	(w, h, n) = map(int, _.split())
	if n > 2 ** (power2(w) + power2(h)):
		print('NO')
	else:
		print('YES')


import math
t = int(input())

def pow_2(n):
	ans = 0
	while n % 2 == 0:
		n //= 2
		ans += 1
	return ans

def solve():
	(w, h, n) = map(int, input().split())
	if math.pow(2, pow_2(w) + pow_2(h)) >= n:
		print('YES')
	else:
		print('NO')
while t:
	solve()
	t -= 1


def list_nechta_bulakka_bulinishi(w, h):
	soni = 0
	while w % 2 == 0:
		w = w // 2
		soni += 1
	while h % 2 == 0:
		h = h // 2
		soni += 1
	return 2 ** soni
t = int(input())
natija = []
for i in range(t):
	(w, h, n) = input().split(' ')
	(w, h, n) = (int(w), int(h), int(n))
	if list_nechta_bulakka_bulinishi(w, h) >= n:
		natija.append('YES')
	else:
		natija.append('NO')
for i in range(t):
	print(natija[i])


cases = int(input())
for i in range(cases):
	(w, h, n) = map(int, input().split())
	count = 1
	while w % 2 == 0:
		w = w // 2
		count *= 2
	while h % 2 == 0:
		h = h // 2
		count *= 2
	if count >= n:
		print('YES')
	else:
		print('NO')


t = int(input())
for q in range(t):
	l1 = list(map(int, input().split()))
	k = 1
	while k <= l1[2]:
		if l1[0] % 2 == 0:
			l1[0] = l1[0] / 2
			k = k * 2
		elif l1[1] % 2 == 0:
			l1[1] = l1[1] / 2
			k = k * 2
		else:
			break
	if k >= l1[2]:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(w, h, n) = map(int, input().split())
	c = 1
	if w % 2 == 0:
		while w % 2 == 0:
			c *= 2
			w /= 2
	if h % 2 == 0:
		while h % 2 == 0:
			c *= 2
			h /= 2
	print('YNEOS'[c < n::2])


t = int(input())
if t >= 1 and t <= 10 ** 4:
	lan = []
	for i in range(t):
		(w, h, n) = map(int, input().split())
		if w >= 1 and h <= 10 ** 4 and (n >= 1) and (n <= 10 ** 9):
			sheet = 1
			while w % 2 == 0:
				w /= 2
				sheet *= 2
			while h % 2 == 0:
				h /= 2
				sheet *= 2
			if sheet >= n:
				lan.append('YES')
			else:
				lan.append('NO')
	print(*lan, sep='\n')


def solve(n):
	c = 0
	while n % 2 != 1:
		n = n // 2
		c += 1
	return c
for _ in range(int(input())):
	(w, h, n) = map(int, input().split())
	if w % 2 != 0 and h % 2 != 0:
		print('YES') if n <= 1 else print('NO')
	elif w % 2 == 0 and h % 2 != 0:
		print('YES') if pow(2, solve(w)) >= n else print('NO')
	elif w % 2 != 0 and h % 2 == 0:
		print('YES') if pow(2, solve(h)) >= n else print('NO')
	elif w % 2 == 0 and h % 2 == 0:
		print('YES') if pow(2, solve(w) + solve(h)) >= n else print('NO')


t = int(input())
for turn in range(t):
	(w, h, a) = map(int, input().split())
	p = 1
	while w % 2 == 0:
		w = w // 2
		p = p * 2
	while h % 2 == 0:
		h = h // 2
		p = p * 2
	if p >= a:
		print('YES')
	else:
		print('NO')


def solve():
	(w, h, n) = list(map(int, input().strip().split()))
	total = 1
	while w % 2 == 0:
		w /= 2
		total *= 2
	while h % 2 == 0:
		h /= 2
		total *= 2
	if total >= n:
		print('YES')
	else:
		print('NO')

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


def yesorno(w, h, n):
	if w % 2 != 0 and h % 2 != 0:
		if n == 1:
			return 'YES'
		else:
			return 'NO'
	else:
		c = 1
		while w % 2 == 0:
			c = c * 2
			w = w / 2
			if n <= c:
				return 'YES'
		while h % 2 == 0:
			c = c * 2
			h = h / 2
			if n <= c:
				return 'YES'
	return 'NO'
t = int(input())
for _ in range(t):
	a = list(map(int, input().split()))
	w = a[0]
	h = a[1]
	n = a[2]
	print(yesorno(w, h, n))