Polycarp remembered the $2020$-th year, and he is happy with the arrival of the new $2021$-th year. To remember such a wonderful moment, Polycarp wants to represent the number $n$ as the sum of a certain number of $2020$ and a certain number of $2021$.

For example, if:

$n=4041$, then the number $n$ can be represented as the sum $2020 + 2021$;

$n=4042$, then the number $n$ can be represented as the sum $2021 + 2021$;

$n=8081$, then the number $n$ can be represented as the sum $2020 + 2020 + 2020 + 2021$;

$n=8079$, then the number $n$ cannot be represented as the sum of the numbers $2020$ and $2021$.

Help Polycarp to find out whether the number $n$ can be represented as the sum of a certain number of numbers $2020$ and a certain number of numbers $2021$.


-----Input-----

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

Each test case contains one integer $n$ ($1 \leq n \leq 10^6$) — the number that Polycarp wants to represent as the sum of the numbers $2020$ and $2021$.


-----Output-----

For each test case, output on a separate line:

"YES" if the number $n$ is representable as the sum of a certain number of $2020$ and a certain number of $2021$;

"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
1
4041
4042
8081
8079
Output
NO
YES
YES
YES
NO


-----Note-----

None

Difficulty: EASY

Solutions:
from sys import stdin, stdout
from collections import *
from math import gcd, floor, ceil

def st():
	return list(stdin.readline().strip())

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

def mp():
	return map(int, stdin.readline().split())

def inp():
	return int(stdin.readline())

def pr(n):
	return stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')

def solve():
	n = inp()
	if n % 2020 <= n // 2020:
		pr('YES')
	else:
		pr('NO')
for _ in range(inp()):
	solve()


from sys import stdin

def readint():
	return int(stdin.readline())

def readarray(typ):
	return list(map(typ, stdin.readline().split()))
for _ in range(readint()):
	n = readint()
	q = n // 2020
	r = n % 2020
	if r <= q:
		print('YES')
	else:
		print('NO')


def solver(n):
	upper = n // 2021 + 1
	for i in range(upper):
		if (n - i * 2021) % 2020 == 0:
			return True
	return False
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	ans = solver(n)
	res = 'YES' if ans is True else 'NO'
	print(res)


for _ in range(int(input())):
	n = int(input())
	print('YES' if n // 2020 >= n % 2020 else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2020 >= n % 2020:
		print('YES')
	else:
		print('NO')


def newYear(a):
	if a < 2020:
		return 'NO'
	else:
		x = 2020
		y = 2021
		while True:
			d = a // x
			if d >= 1:
				low = d * x
				hi = d * y
				return 'YES' if low <= a <= hi else 'NO'
			return 'NO'
n = int(input())
for i in range(n):
	print(newYear(int(input())))


for tests in range(int(input())):
	n = int(input())
	if n % 2020 == 0:
		print('YES')
	elif n % 2021 == 0:
		print('YES')
	else:
		x = n // 2020 + 1
		sum = 0
		flag = 'NO'
		for i in range(x):
			n -= 2020
			if n % 2021 == 0:
				flag = 'YES'
				break
		print(flag)


def as_sum(x):
	r = x % 2020
	q = x // 2020
	if q >= r:
		return True
	return False
t = int(input())
for _ in range(t):
	if as_sum(int(input())):
		print('YES')
	else:
		print('NO')


def solution():
	n = int(input())
	nums = []
	for i in range(n):
		nums.append(int(input()))
	ans = []
	for num in nums:
		cnt21 = num % 2020
		cnt20 = (num - cnt21) / 2020 - cnt21
		if cnt20 >= 0 and 2020 * cnt20 + 2021 * cnt21 == num:
			ans.append('YES')
		else:
			ans.append('NO')
	for i in ans:
		print(i)
solution()


t = int(input())
for i in range(t):
	n = int(input())
	x = divmod(n, 2020)
	if x[1] > x[0]:
		print('NO')
	else:
		print('YES')


def check(n):
	a = n % 2020
	b = n // 2020
	return a <= b
t = int(input())
for r in range(t):
	n = int(input())
	if check(n):
		print('YES')
	else:
		print('NO')


t = int(input())
lst = []
for _ in range(t):
	n = int(input())
	y = n % 2020
	if (n - y) / 2020 - y >= 0:
		lst.append('YES')
	else:
		lst.append('NO')
for i in lst:
	print(i)


tests = int(input())
for t in range(tests):
	a = int(input())
	if a // 2020 >= a % 2020:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = n // 2020
	b = n % 2020
	if a >= b and a > 0:
		print('YES')
	else:
		print('NO')


import math

def s(a, b, n):
	i = 0
	while i * a <= n:
		if (n - i * a) % b == 0:
			return 1
		i = i + 1
	return 0
for _ in range(int(input())):
	n = int(input())
	if s(2020, 2021, n):
		print('YES')
	else:
		print('NO')


a = 2020
b = 2021
for _ in range(int(input())):
	n = int(input())
	z = 0
	if n < a:
		z = 0
	else:
		m = n % a
		k = n // a
		if m <= k:
			z = 1
	if z == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	x = n - n % 2020 * 2021
	if x >= 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	y = n % 2020
	if (n - y) / 2020 - y >= 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	mod = n % 2020
	div = n // 2020
	if mod <= div:
		print('YES')
	else:
		print('NO')


def solve(n):
	if n < 2020:
		print('NO')
		return
	if n % 2020 == 0 or n % 2021 == 0:
		print('YES')
		return
	k = n
	count = 0
	while k % 2020 != 0:
		k = k - 1
		count += 1
	if count * 2021 <= n:
		print('YES')
		return
	print('NO')
	return
t = int(input())
for _ in range(t):
	n = int(input())
	solve(n)


L = [False] * int(1000000.0 + 1)
L[2020] = True
L[2021] = True
for i in range(2022, len(L)):
	if L[i - 2020] or L[i - 2021]:
		L[i] = True
t = int(input())
for _ in range(t):
	if L[int(input())]:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	k = 0
	r = 0
	while n >= 2020:
		n -= 2020
		k += 1
	if n <= k:
		print('YES')
	else:
		print('NO')


cases = int(input())
item = []
for i in range(cases):
	item.append(int(input()))
for i in item:
	a = i % 2020
	if a <= i // 2020:
		print('YES')
	else:
		print('NO')


for d in [*open(0)][1:]:
	n = int(d)
	print('YNEOS'[n % 2020 > n // 2020::2])


def nYN(number, cache):
	if number in cache:
		return cache[number]
	if number == 2020 or number == 2021:
		cache[number] = True
		return True
	elif number < 2020:
		cache[number] = False
		return False
	else:
		cache[number] = nYN(number - 2020, cache) or nYN(number - 2021, cache)
		return cache[number]
memo = {}
t = int(input())
for _ in range(t):
	n = int(input())
	if n in memo:
		print('YES' if memo[n] else 'NO')
	else:
		print('YES' if nYN(n, memo) else 'NO')


def isHill(i):
	if i == 0 or i == n - 1:
		return 0
	if l[i] > l[i - 1] and l[i] > l[i + 1]:
		return 1
	return 0

def isVal(i):
	if i == 0 or i == n - 1:
		return 0
	if l[i] < l[i - 1] and l[i] < l[i + 1]:
		return 1
	return 0

def count(i):
	return isHill(i) + isVal(i)
mod = int(1000000000.0) + 7
N = 1000001
l = [0] * N
for i in range(2020, N, 2020):
	for j in range(i, N, 2021):
		if l[j] == 1:
			break
		l[j] = 1
for i in range(2021, N, 2021):
	l[i] = 1

def ip(mode):
	if mode == 0:
		return int(input())
	if mode == 1:
		return list(map(int, input().split()))
	if mode == 2:
		return input()
	if mode == 3:
		return list(map(str, input().split()))
	if mode == 4:
		return map(int, input().split())
	if mode == 5:
		return map(str, input().split())
for _ in range(int(input())):
	n = ip(0)
	if l[n]:
		print('YES')
	else:
		print('NO')


def check(x):
	if x % 2020 < x // 2020 or x % 2021 == 0:
		return True
	return False
t = int(input())
for i in range(t):
	n = int(input())
	if check(n):
		print('YES')
	else:
		print('NO')


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	if n // 2020 < n % 2020:
		ans.append('NO')
	else:
		ans.append('YES')
for (i, v) in enumerate(ans):
	print(v)


t = int(input())
for _ in range(t):
	n = int(input())
	flag = 0
	if n < 2020:
		flag = 0
	elif n % 2020 == 0 or n % 2021 == 0:
		flag = 1
	else:
		ab = n // 2020
		b = n % 2020
		if b > ab:
			flag = 0
		else:
			a = ab - b
			if n == a * 2020 + b * 2021:
				flag = 1
			else:
				flag = 0
	if flag == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
while n > 0:
	k = int(input())
	for i in range(k // 2020 + 1):
		rem = k - i * 2020
		if rem % 2021 == 0:
			print('YES')
			break
	else:
		print('NO')
	n -= 1


res = ''
for _ in range(int(input())):
	n = int(input())
	_2020req = n // 2020
	if n > _2020req * 2021:
		res += 'NO\n'
	else:
		res += 'YES\n'
print(res)


import sys, random, bisect
from collections import deque, defaultdict
from heapq import heapify, heappop, heappush
from itertools import permutations
from math import gcd, log
mod = int(1000000000.0 + 7)
inf = int(1e+20)
input = lambda : sys.stdin.readline().rstrip()
mi = lambda : map(int, input().split())
li = lambda : list(mi())
t = int(input())
for _ in range(t):
	n = int(input())
	m = n // 2020
	if n - m * 2020 > m:
		print('NO')
	else:
		print('YES')


a = ['NO'] * 1000001
for i in range(0, 1000001, 2020):
	for j in range(0, 1000001, 2021):
		if i + j <= 1000000:
			a[i + j] = 'YES'
t = int(input())
for i in range(t):
	print(a[int(input())])


for _ in range(int(input())):
	n = int(input())
	n = n - 2021 * (n % 10)
	while n >= 2020:
		if n % 2020 == 0:
			n = 0
			break
		n -= 20210
	if n == 0:
		print('YES')
	else:
		print('NO')


def func():
	n = int(input())
	for _ in range(n):
		num = int(input())
		(div, mod) = divmod(num, 2020)
		if div >= mod:
			print('YES')
		else:
			print('NO')
func()


for t in range(int(input())):
	n = int(input())
	n2 = n // 2020
	n1 = n % 2020
	if n1 <= n2:
		print('YES')
	else:
		print('NO')


import math
import sys

def solve(n: int) -> bool:
	rest = n % 2020
	val = n / 2020
	return rest <= val
t = int(sys.stdin.readline())
for i in range(t):
	n = int(sys.stdin.readline())
	print('YES' if solve(n) else 'NO')


for i in range(int(input())):
	a = int(input())
	if a < 2020:
		print('NO')
	elif a % 2021 == 0 or a % 2021 > a % 2020:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = int(input())
	c = a % 2020
	b = a - c * 2021
	if b >= 0 and b % 2020 == 0:
		print('YES')
	else:
		print('NO')


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_list_string():
	return list(map(str, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()

def get_int():
	return int(sys.stdin.readline().strip())

def get_print_int(x):
	sys.stdout.write(str(x) + '\n')

def get_print(x):
	sys.stdout.write(x + '\n')

def get_print_int_same(x):
	sys.stdout.write(str(x) + ' ')

def get_print_same(x):
	sys.stdout.write(x + ' ')
from sys import maxsize

def solve():
	for _ in range(get_int()):
		n = get_int()
		if n % 2020 <= n // 2020:
			get_print('YES')
		else:
			get_print('NO')
solve()


t = int(input())
for tt in range(t):
	n = int(input())
	a = n % 2020
	d = n // 2020
	print('YES' if a <= d else 'NO')


global l

def init():
	l[2020] = True
	l[2021] = True
	for i in range(int(1000000.0) + 1):
		if l[i] == True:
			l[i + 2020] = True
			l[i + 2021] = True

def solve():
	val = int(input())
	if l[val] == True:
		print('YES')
	else:
		print('NO')
l = [False for i in range(int(1000000.0) + 2023)]
init()
t = int(input())
for i in range(t):
	solve()


t = int(input())
for test in range(t):
	n = int(input())
	flag = 0
	while n >= 0:
		if n % 2021 == 0:
			flag = 1
			break
		n -= 2020
	if flag == 1:
		print('YES')
	else:
		print('NO')


for _ in ' ' * int(input()):
	n = int(input())
	print('YNEOS'[n // 2020 < n % 2020::2])


t = int(input())
for t in range(0, t):
	q = list(map(int, input().rstrip().split()))
	n = q[0]
	if n % 2020 == 0 or n % 2021 == 0:
		print('YES')
	else:
		j = 0
		d = n
		while n > 2020:
			n = n - 2020
			if n % 2021 == 0:
				j = 1
				break
		if j == 1:
			print('YES')
		else:
			print('NO')


out = []

def newyear():
	n = int(input())
	mod = n % 2020
	div = n / 2020
	if mod <= div:
		out.append('YES')
	else:
		out.append('NO')
iter = int(input())
while iter > 0:
	newyear()
	iter -= 1
for x in range(0, len(out)):
	print(out[x])


def main():
	t = int(input())
	for i in range(t):
		num = int(input())
		counter = 0
		temp = 0
		counter = num // 2020
		rem = num % 2020
		if counter == 0:
			print('NO')
		elif rem > counter:
			print('NO')
		else:
			print('YES')
main()


for n in range(int(input())):
	num = int(input())
	if num >= 2020 and num % 2020 <= num / 2020:
		print('YES')
	else:
		print('NO')


number_of_test_case = int(input())
arr = []
for i in range(number_of_test_case):
	user_input = int(input())
	arr.append(user_input)
for num in arr:
	if num // 2020 >= num % 2020:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	k = 0
	for j in range(n // 2020 + 1):
		if (n - j * 2020) % 2021 == 0:
			k = 1
			break
	print('YES') if k else print('NO')


for i in range(int(input())):
	temp = int(input())
	if temp >= 2020 and (temp % 2020 == 0 or temp % 2020 <= temp // 2020):
		print('YES')
	else:
		print('NO')


import math
import sys
from collections import *
from bisect import bisect_left, bisect_right

def cint():
	return list(map(int, sys.stdin.readline().strip().split()))

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

def solve():
	n = int(input())
	if n < 2020:
		print('NO')
	elif n % 2020 == 0 or n % 2021 == 0:
		print('YES')
	else:
		maxx = n // 2020
		if n >= maxx * 2020 and n <= maxx * 2021:
			print('YES')
		else:
			print('NO')
t = int(input())
while t != 0:
	solve()
	t -= 1


import sys
t = int(input())
for i in range(t):
	n = int(sys.stdin.readline())
	if n // 2020 >= n % 2020:
		print('YES')
	else:
		print('NO')


tests = int(input())
for _ in range(tests):
	n = int(input())
	if n < 2020:
		print('NO')
	else:
		t = n // 2020
		m = n % 2020
		print('YES' if t >= m else 'NO')


from sys import stdin, stdout
import array
input_ = stdin.readline
test_cases = int(input_())
dp = [0]
for i in range(test_cases):
	num = int(input())
	for i in range(num):
		if num == 0:
			print('YES')
			break
		elif num != 0 and num < (2020 or 2021):
			print('NO')
			break
		elif num % 2020 == 0:
			num -= 2020
		else:
			num -= 2021


import math
for w in range(int(input())):
	n = int(input())
	if n % 2020 == 0 or n % 2021 == 0:
		print('YES')
	else:
		t = 1
		x = n
		while x % 2021 != 0 and x >= 0:
			x -= 2020
		if x > 0:
			print('YES')
		else:
			print('NO')


for s in [*open(0)][1:]:
	s = int(s)
	print(['NO', 'YES'][s // 2020 >= s % 2020])


for _ in range(int(input())):
	n = int(input())
	if n < 2020:
		print('NO')
		continue
	if n % 2020 == 0 or n % 2021 == 0:
		print('YES')
		continue
	found = False
	while n > 0:
		A = str(n)
		a = int(A[-1])
		if n % 2020 == 0 or n % 2021 == 0:
			print('YES')
			found = True
			break
		if a == 0:
			a = 10
		n -= a * 2021
	if not found:
		print('NO')


t = int(input())

def isRepresents(n):
	if n < 2020:
		return False
	if n % 2020 == 0 or n % 2021 == 0 or n % 2021 % 2020 == 0:
		return True
	aux = 2021 - n % 2021
	if n - aux * 2020 >= 0 and (n - aux * 2020) % 2021 == 0:
		return True
	return False
for i in range(t):
	n = int(input())
	if isRepresents(n):
		print('YES')
	else:
		print('NO')


n = int(input())
array = []
for i in range(0, n):
	array.append(int(input()))
for i in range(0, n):
	num = array[i]
	integer = num // 2020
	decimal = num % 2020
	if decimal == 0:
		print('YES')
		continue
	elif decimal <= integer:
		print('YES')
		continue
	else:
		print('NO')


for i in range(int(input())):
	a = int(input())
	cnt2021 = a % 2020
	cnt2020 = (a - cnt2021) // 2020 - cnt2021
	if cnt2020 >= 0 and 2020 * cnt2020 + 2021 * cnt2021 == a:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	quot = n // 2020
	rem = n % 2020
	if quot >= rem:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 2020:
		print('NO')
	else:
		num = int(n / 2020)
		d = n - 2020 * num
		if d <= num:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	y = n % 2020
	x = (n - y) / 2020 - y
	if x >= 0 and 2020 * x + y * 2021 == n:
		print('YES')
	else:
		print('NO')


import math
t = int(input())
while t != 0:
	number = int(input())
	if number < 2020:
		print('NO')
	else:
		pppp = number % 2020
		num = pppp * 2021
		v = number - num
		if v % 2020 == 0 and v >= 0:
			print('YES')
		else:
			print('NO')
	t -= 1


t = int(input())
result = []
for _ in range(t):
	n = int(input())
	cnt = n // 2020
	res = n % 2020
	if res <= cnt:
		result.append('YES')
	else:
		result.append('NO')
for i in result:
	print(i)


import math
import sys
import itertools
import fractions
wtf = sys.stdin.read()
wtf = wtf.strip().split('\n')
t = int(wtf[0])
for n in wtf[1:]:
	n = int(n)
	(xy, y) = divmod(n, 2020)
	print('YES' if xy >= y else 'NO')


def main():
	n = int(input())
	for i in range(n):
		cur = int(input())
		if cur // 2020 >= cur % 2020:
			print('YES')
		else:
			print('NO')
main()


c = int(input())
n1 = 0
n0 = 0
l = []
for i in range(0, c):
	ans = 'YES'
	a = int(input())
	n1 = a % 2020
	if a - n1 * 2021 < 0:
		ans = 'NO'
		l.append(ans)
	else:
		n0 = (a - n1 * 2021) // 2020
		if 2020 * n0 + 2021 * n1 == a:
			l.append(ans)
		else:
			ans = 'NO'
			l.append(ans)
for z in l:
	print(z)


def solve():
	n = int(input())
	for i in range(n // 2021 + 1):
		if i * 2021 <= n and (n - i * 2021) % 2020 == 0:
			print('YES')
			return
	print('NO')
t = int(input())
for _ in range(t):
	solve()


import math
from sys import stdin, stdout
t = int(stdin.readline())
for i in range(t):
	n = int(stdin.readline())
	c = n // 2020
	d = n % 2020
	if d <= c:
		print('YES')
	else:
		print('NO')


s = [int(input()) for i in range(int(input()))]
for i in s:
	y = i % 2020
	x = (i - y) / 2020 - y
	if y >= 0 and x >= 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for tc in range(t):
	n = int(input())
	(x1, y1) = (n % 2020, n // 2020)
	if y1 >= x1:
		print('YES')
	else:
		print('NO')


b = int(input())
for i in range(b):
	a = int(input())
	if a >= 2020 and a % 2020 == 0 or a % 2021 == 0:
		print('YES')
	elif a < 2020:
		print('NO')
	else:
		x = a % 2020
		y = a % 2021
		y = 2021 - y
		z = 2020 * y + 2021 * x
		if z == a:
			print('YES')
		else:
			print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	if n < 2020:
		print('NO')
		continue
	b = n % 2020
	aPb = n // 2020
	a = aPb - b
	if a < 0:
		print('NO')
		continue
	if 2020 * a + 2021 * b == n:
		ans = 'YES'
	else:
		ans = 'NO'
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 2020:
		print('NO')
	else:
		m = n // 2020
		if n in range(2020 * m, 2021 * m + 1):
			print('YES')
		else:
			print('NO')


t = int(input())
for T in range(t):
	n = int(input())
	x = n // 2020
	if n - x * 2020 <= x:
		print('YES')
	else:
		print('NO')


n = int(input())
lst = []
for i in range(n):
	lst.append(int(input()))
for j in lst:
	q = True
	y = int(j / 2021)
	for a in range(y + 1):
		x = (j - 2021 * a) / 2020
		if x == int(x):
			print('YES')
			q = False
	if q:
		print('NO')


for i in range(int(input())):
	s = input()
	n = int(s)
	if n < 2020:
		print('NO')
	else:
		k = n // 2020
		m = n - k * 2020
		if m <= k:
			print('YES')
		else:
			print('NO')


n = int(input())
nums = []
for i in range(n):
	nums.append(int(input()))
for i in nums:
	ceil = i // 2020
	y = i - ceil * 2020
	if y <= ceil:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	x = 0
	out = False
	while x < 500:
		if n >= 2020 * x and (n - 2020 * x) % 2021 == 0:
			print('YES')
			out = True
			break
		elif n < 2020 * x:
			break
		x += 1
	if not out:
		print('NO')


def solve(a, b, n):
	i = 0
	while i * a <= n:
		if (n - i * a) % b == 0:
			print('YES')
			return 0
		i = i + 1
	print('NO')
a = 2020
b = 2021
t = int(input())
for i in range(t):
	n = int(input())
	solve(a, b, n)


from sys import stdin
_input = stdin.readline
(_int, _range) = (int, range)

def solution():
	for _ in _range(_int(_input())):
		n = _int(_input())
		s = 0
		while s * 2020 <= n:
			if (n - s * 2020) % 2021 == 0:
				print('YES')
				break
			s += 1
		else:
			print('NO')
solution()


def main():
	for _ in range(int(input())):
		print('YES' if solve(int(input())) else 'NO')

def solve(n):
	if n % 2020 <= n // 2020:
		return True
	else:
		return False
main()


from functools import lru_cache

@lru_cache(None)
def p2(n):
	if n < 0:
		return False
	if n == 0:
		return True
	return p2(n - 2020) or p2(n - 2021)

def read_int():
	line = input()
	return int(line)

def read_digits():
	line = input()
	return list(map(int, line))

def main():
	tests = read_int()
	for _ in range(tests):
		n = read_int()
		if p2(n):
			print('YES')
		else:
			print('NO')
main()


times = int(input())

def check(n):
	remainder = n % 2020
	quotient = n // 2020
	if remainder <= quotient:
		return 'YES'
	else:
		return 'NO'
arr = []
for i in range(times):
	arr.append(check(int(input())))
for i in range(times):
	print(arr[i])


t = int(input())
for _ in range(t):
	n = int(input())
	y = n // 2021
	tr = 0
	for i in range(y + 1):
		if (n - 2021 * i) % 2020 == 0:
			tr = 1
			break
	if tr == 1:
		print('YES')
	else:
		print('NO')


def check(n):
	bol = 'NO'
	while n >= 2020:
		if n % 2020 == 0 or n % 2021 == 0:
			bol = 'YES'
			break
		n -= 2021
	return bol
for _ in range(int(input())):
	print(check(int(input())))


a = int(input())
for i in range(a):
	k = int(input())
	b = k // 2020
	if k == 1:
		print('NO')
	if k != 1:
		if k == 2020 * b:
			print('YES')
		elif k <= 2020 * b + b and k >= 2020 * b:
			print('YES')
		else:
			print('NO')


def fixer(n):
	if n % 2020 == 0 or n % 2021 == 0:
		return 'YES'
	c = n // 10
	x = n - c * 10
	z = n // 2021
	for i in range(x, z + 1, 10):
		w = n - i * 2021
		if w > 0 and w % 2020 == 0:
			return 'YES'
	return 'NO'
t = int(input())
for i in range(t):
	b = int(input())
	print(fixer(b))


for _ in range(int(input())):
	n = int(input())
	y = n % 2020
	x = (n - y) // 2020 - y
	f = x >= 0 and y >= 0
	if f:
		print('YES')
	else:
		print('NO')


def posi(n):
	x = n // 2020
	for i in range(x + 1):
		y = (n - i * 2020) / 2021
		if y == int(y):
			return True
	return False
test = int(input())
for i in range(test):
	n = int(input())
	if posi(n):
		print('YES')
	else:
		print('NO')


import math
t = int(input())
while t != 0:
	n = int(input())
	if n < 2020:
		print('NO')
	else:
		p = n % 2020
		num = p * 2021
		x = n - num
		if x % 2020 == 0 and x >= 0:
			print('YES')
		else:
			print('NO')
	t -= 1


def solve(n):
	if n < 2020:
		return False
	for i in range(1, 10 ** 4):
		if (n - i * 2020) % 2021 == 0 and n - i * 2020 >= 0:
			return True
	for i in range(1, 10 ** 4):
		if (n - i * 2021) % 2020 == 0 and n - i * 2021 >= 0:
			return True
	return False
t = int(input())
for _ in range(t):
	n = int(input())
	if solve(n) == True:
		print('YES')
	else:
		print('NO')


ans = []
for _ in range(int(input())):
	n = int(input())
	if n < 2020:
		ans += ['NO']
	elif n % 2020 == 0 or n % 2021 == 0:
		ans += ['YES']
	elif n // 2020 >= n % 2020:
		ans += ['YES']
	else:
		ans += ['NO']
print('\n'.join(ans))


from sys import *
from collections import defaultdict as dd
from math import *
from bisect import *

def sinp():
	return input()

def inp():
	return int(sinp())

def minp():
	return map(int, sinp().split())

def linp():
	return list(minp())

def strl():
	return list(sinp())

def pr(x):
	print(x)
mod = int(1000000000.0 + 7)
for _ in range(inp()):
	n = inp()
	flag = False
	while n >= 0:
		if n % 2020 == 0 or n % 2021 == 0:
			flag = True
			break
		n -= 4041
	if flag:
		pr('YES')
	else:
		pr('NO')


ll = lambda : map(int, input().split())
t = lambda : int(input())
ss = lambda : input()

def f(n):
	if n < 2020:
		return 0
	num = n // 2020
	mod = n % 2020
	if mod == 0:
		return 1
	if mod <= num:
		return 1
	return 0
for _ in range(t()):
	n = t()
	if f(n):
		print('YES')
	else:
		print('NO')


p = int(input())
while p:
	n = int(input())
	a = 2021 * (n % 2020)
	b = n - a
	if b % 2020 == 0 and b >= 0:
		print('YES')
	else:
		print('NO')
	p -= 1


import sys
t = int(sys.stdin.readline())
for i in range(t):
	n = int(sys.stdin.readline())
	a = n // 2020
	if a > 0 and 2020 * a <= n <= 2020 * a + a:
		print('YES')
	else:
		print('NO')


t = int(input())
for tt in range(t):
	n = int(input())
	if n < 2020:
		print('NO')
		continue
	if n % 2020 == 0 or n % 2021 == 0:
		print('YES')
		continue
	f = 0
	while n >= 2020:
		if n % 2020 == 0:
			f = 1
			break
		n = n - 2021
	if f == 1:
		print('YES')
	else:
		print('NO')


for s in [*open(0)][1:]:
	n = int(s)
	print('YNEOS'[n % 2020 > n // 2020::2])


for _ in range(int(input())):
	n = int(input())
	r = n % 2020
	print('YES' if n - r * 2021 >= 0 and (n - r * 2021) % 2020 == 0 else 'NO')


from sys import stdin
lst = list(map(int, stdin.read().split()))
s = 0

def inp(n=1):
	global s
	ret = lst[s:s + n]
	s += n
	return ret

def inp1():
	return inp()[0]
t = inp1()
num = inp(t)
for i in num:
	print('YES' if i % 2020 <= i // 2020 else 'NO')


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	if n < 2020:
		ans.append('NO')
	elif n % 2020 == 0 or n % 2021 == 0:
		ans.append('YES')
	elif n % 2020 == 1:
		ans.append('YES')
	elif n % 2020 != 0 or n % 2021 != 0:
		x = n % 2020
		y = 2021 * x
		if y > n:
			ans.append('NO')
		else:
			n -= y
			if n % 2020 == 0:
				ans.append('YES')
	else:
		ans.append('NO')
for i in ans:
	print(i)


def f():
	n = int(input())
	for _ in range(n):
		x = int(input())
		d = x // 2020
		r = x % 2020
		if r > d or d == 0:
			print('NO')
		else:
			print('YES')
f()


test_cases = int(input())
for i in range(test_cases):
	number = int(input())
	if number < 2020:
		print('NO')
	elif number % 2020 <= number / 2020:
		print('YES')
	else:
		print('NO')


def sum(a):
	x = a % 2020
	y = a // 2020
	if x <= y:
		return 'YES'
	else:
		return 'NO'
t = int(input())
for i in range(t):
	n = int(input())
	print(sum(n))


d = set()
for i in range(0, 500):
	for j in range(0, 500):
		x = 2020 * i + 2021 * j
		y = 2020 * i
		z = 2021 * j
		d.add(x)
		d.add(y)
		d.add(z)
t = int(input())
for _i in range(t):
	a = int(input())
	if a in d:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	x = n % 2020
	y = n - x * 2021
	if y >= 0:
		if y % 2020 == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	cnt21 = n % 2020
	cnt20 = (n - cnt21) / 2020 - cnt21
	if cnt20 >= 0 and 2020 * cnt20 + 2021 * cnt21 == n:
		print('YES')
	else:
		print('NO')


test = int(input())
while test:
	n = int(input())
	x = n // 2020
	ans = x * 2020
	a = 0
	for i in range(2):
		a += 1
	while x > 0:
		if ans != n:
			ans += 1
		else:
			break
		x -= 1
	if ans == n:
		print('YES')
	else:
		print('NO')
	test -= 1


t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	if n // 2020 >= n % 2020:
		ans.append('YES')
	else:
		ans.append('NO')
for i in ans:
	print(i)


n = int(input())
nums = []
for i in range(n):
	ele = int(input())
	nums.append(ele)
for i in range(n):
	if nums[i] % 2020 <= nums[i] // 2020:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	print(['NO', 'YES'][n - n % 2020 * 2021 >= 0])


import sys

def rl():
	return sys.stdin.readline().strip()

def rl_types(types):
	str_list = [x for x in sys.stdin.readline().strip().split(' ')]
	return [types[i](str_list[i]) for i in range(len(str_list))]

def pr(something):
	sys.stdout.write(str(something) + '\n')

def pra(array):
	sys.stdout.write(' '.join([str(x) for x in array]) + '\n')

def solve(array):
	return array
NT = int(rl())
for ti in range(NT):
	v = int(rl())
	cando = False
	neven = v // 2020
	rem = v - neven * 2020
	cando = rem <= neven
	pr('YES' if cando else 'NO')