Read problems statements in Russian here 
The Head Chef has been playing with Fibonacci numbers for long . He has learnt several tricks related to Fibonacci numbers . Now he wants to test his chefs in the skills . 
 
A fibonacci number is defined by the recurrence :
 
f(n) = f(n-1) + f(n-2) for n > 2 
and f(1) = 0 
and f(2) = 1 .  

Given a number  A   , determine if it is a fibonacci number.

------ Input ------ 

The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
The only line of each test case contains a single integer  A  denoting the number to be checked .

------ Output ------ 

For each test case, output a single line containing "YES" if the given number is a fibonacci number , otherwise output a single line containing "NO" . 

------ Constraints ------ 

$1 ≤ T ≤ 1000$
$1 ≤ number of digits in A  ≤ 1000$
$  The sum of number of digits in A in all test cases   ≤ 10000.  $

----- Sample Input 1 ------ 
3
3
4
5
----- Sample Output 1 ------ 
YES
NO
YES
----- explanation 1 ------ 
Example case 1. The first few fibonacci numbers are 0 , 1 , 1 , 2 , 3 ,5 , 8 , 13 and so on and the series is increasing . Only 3 and 5 appear in this series while 4 does not appear in the series .

Difficulty: MEDIUM_HARD

Solutions:
try:
	from debug import debug, timer
except ImportError:
	pass
from sys import stdin
input = stdin.readline

def rii():
	return range(int(input().strip()))

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

def mii():
	return map(int, input().strip().split(' '))

def lmii():
	return list(map(int, input().strip().split(' ')))

def si():
	return str(input().strip())

def getvals():
	while True:
		yield from input().split()

def tri(n):
	return n * (n + 1) // 2

def smallest_first(m, n):
	return (min(m, n), max(m, n))

def fibonacci(n):

	def fib_inner(n):
		if n == 0:
			return (0, 1)
		(u, v) = fib_inner(n >> 1)
		q = (n & 2) - 1
		u *= u
		v *= v
		if n & 1:
			return (u + v, 3 * v - 2 * (u - q))
		return (2 * (v + q) - 3 * u, u + v)
	(u, v) = fib_inner(n >> 1)
	l = 2 * v - u
	if n & 1:
		q = (n & 2) - 1
		return v * l + q
	return u * l
max_fib_length = 1000
fibs = list()

def gen_fibs():
	n = 1
	f = fibonacci(n)
	while len(str(f)) < max_fib_length:
		fibs.append(f)
		n += 1
		f = fibonacci(n)

def solve(a):
	return 'YES' if a in fibs else 'NO'

def do_codechef():
	gen_fibs()
	for t in rii():
		print(solve(ii()))
do_codechef()
exit()


f = [0, 1]
num = 10 ** 1000
while f[-1] <= num:
	f.append(f[-1] + f[-2])
t = int(input())
for i in range(0, t):
	a = int(input())
	flag = 0
	for j in f:
		if j == a:
			flag = 1
	if flag == 1:
		print('YES')
	else:
		print('NO')


d = {}
d[0] = 0
d[1] = 1
for i in range(2, 100001):
	d[i] = d[i - 1] + d[i - 2]
t = int(input())
s = set(d.values())
while t:
	t -= 1
	n = int(input())
	if n in s:
		print('YES')
	else:
		print('NO')


tc = input()
arr = [0, 1, 1, 2, 3, 5]
lst = 5
for i in range(100000):
	cur = arr[lst] + arr[lst - 1]
	arr.append(cur)
	lst = lst + 1
len1 = len(arr)
for i1 in range(int(tc)):
	n = int(input())
	ans = 0
	for i in range(len1):
		if arr[i] > n:
			break
		if arr[i] == n:
			ans = 1
	if ans == 1:
		print('YES')
	else:
		print('NO')


b = 10 ** 1000
a = []
f1 = 0
f2 = 1
while f2 <= b:
	f3 = f1 + f2
	f1 = f2
	f2 = f3
	a.append(f3)
t = int(input())
for i in range(t):
	n = int(input())
	if n in a:
		print('YES')
	else:
		print('NO')


a = 0
b = 1
cnt = 0
lst = []
while True:
	d = a + b
	b = a
	a = d
	cnt = cnt + 1
	lst.append(d)
	if cnt > 5000:
		break
tc = int(input())
for _ in range(tc):
	s = int(input())
	if s in lst:
		print('YES')
	else:
		print('NO')


S = set()
S.add(0)
a = 0
b = 1
while len(str(b)) <= 1000:
	(b, a) = (a + b, b)
	S.add(b)
for _ in range(int(input())):
	N = int(input())
	if N in S:
		print('YES')
	else:
		print('NO')


from bisect import bisect_left
t = int(input())
fibs = [0, 1]
while True:
	fib = fibs[-1] + fibs[-2]
	if fib < 10 ** 1001:
		fibs.append(fib)
	else:
		break
while t:
	t = t - 1
	a = int(input())
	i = bisect_left(fibs, a)
	if i != len(fibs) and fibs[i] == a:
		print('YES')
	else:
		print('NO')


a = [0, 1]
for i in range(2, 10001):
	a.append(a[i - 1] + a[i - 2])
for t in range(int(input())):
	n = int(input())
	if n in a:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	t = 0
	t1 = 0
	u = 0
	t2 = 1
	if n == 0:
		print('YES')
	elif n == 1:
		print('YES')
	else:
		while t <= n:
			t = t1 + t2
			t2 = t1
			t1 = t
			if t == n:
				u += 1
		if u == 1:
			print('YES')
		else:
			print('NO')


fib_lst = [0, 1]
dic = {}
for i in range(2, 4000):
	fib_lst.append(fib_lst[i - 1] + fib_lst[i - 2])
for x in fib_lst:
	dic[x] = 1

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


a = []
a.append(0)
a.append(1)
for i in range(2, 100002):
	a.append(a[i - 1] + a[i - 2])
s = set(a)
t = int(input())
while t > 0:
	n = int(input())
	if n in s:
		print('YES')
	else:
		print('NO')
	t -= 1


d = {}
d[0] = 0
d[1] = 1
for i in range(2, 100001):
	d[i] = d[i - 1] + d[i - 2]
T = int(input())
S = set(d.values())
for t in range(T):
	N = int(input())
	if N in S:
		print('YES')
	else:
		print('NO')


(a, b, c) = (0, 1, 1)
(Range, fib) = (10 ** 1001, [a, b])
while a + b <= Range:
	c = a + b
	fib.append(c)
	a = b
	b = c
for _ in range(int(input())):
	n = int(input())
	if n in fib:
		print('YES')
	else:
		print('NO')


lst = [0, 1]
dc = {}
for i in range(2, 8000):
	lst.append(lst[i - 1] + lst[i - 2])
for x in lst:
	dc[x] = 1
t = int(input())
for x in range(t):
	n = int(input())
	if n in dc:
		print('YES')
	else:
		print('NO')


def is_sq(n):
	minim = 1
	maxim = n
	while minim <= maxim:
		mid = (minim + maxim) // 2
		cur = mid * mid
		if cur > n:
			maxim = mid - 1
		elif cur == n:
			return True
		else:
			minim = mid + 1
	return False
T = int(input())
while T > 0:
	T -= 1
	N = int(input())
	if is_sq(5 * N * N + 4):
		print('YES')
	elif is_sq(5 * N * N - 4):
		print('YES')
	else:
		print('NO')


d = {}
a = 0
b = 1
c = a + b
for i in range(1, 4783):
	a = b
	b = c
	c = a + b
	d[c] = i
t = int(input())
while t != 0:
	t -= 1
	q = int(input())
	if q in d:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = int(input())
	(x, y, s, f) = (0, 1, 0, 0)
	while s <= a:
		s = x + y
		x = y
		y = s
		if s == a:
			print('YES')
			f = 1
			break
	if f == 0:
		print('NO')


l = [0, 1]
for i in range(4800):
	l.append(l[-1] + l[-2])
for i in range(int(input())):
	x = int(input())
	if x in l:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	pr1 = 0
	pr2 = 1
	while pr2 < n:
		tm = pr1
		pr1 = pr2
		pr2 = tm + pr2
	if pr2 == n:
		print('YES')
	else:
		print('NO')


l = [0, 1]
while True:
	l.append(l[-1] + l[-2])
	if len(str(l[-1])) > 1000:
		break
t = int(input())
for i in range(t):
	n = int(input())
	print('YES' if n in l else 'NO')


mem = [0] * (4784 + 1)

def makef():
	mem[1] = 1
	mem[2] = 2
	for i in range(3, 4784):
		mem[i] = mem[i - 1] + mem[i - 2]
makef()
t = int(input())
for _ in range(t):
	a = int(input())
	yes = 'NO'
	imin = 1
	imax = 4784
	i = (imax - imin) // 2 + imin
	while True:
		if a == mem[i]:
			yes = 'YES'
			break
		elif a < mem[i]:
			imax = i
			i = (imax - imin) // 2 + imin
		else:
			imin = i
			i = (imax - imin) // 2 + imin
		if imax - imin <= 1:
			break
	print(yes)


from decimal import *

def checkFib():
	num = Decimal(input())
	current = 1
	prev = 0
	while current < num:
		temp = prev
		prev = current
		current = current + temp
	if current == num:
		print('YES')
	else:
		print('NO')
tcs = int(input())
for i in range(tcs):
	checkFib()


fib = [0, 1]
for i in range(2, 10 ** 4 + 1):
	fib.append(fib[i - 1] + fib[i - 2])
for t in range(int(input())):
	n = int(input())
	if n in fib:
		print('YES')
	else:
		print('NO')


fibs = [0, 1]
[fibs.append(fibs[i - 1] + fibs[i - 2]) for i in range(2, 6500)]
for n in range(int(input())):
	x = int(input())
	i = 0
	while True:
		if fibs[i] == x:
			print('YES')
			break
		elif fibs[i] > x:
			print('NO')
			break
		i += 1


lim = 10 ** 1000
fib = [0, 1]
while fib[-1] <= lim:
	fib.append(fib[-1] + fib[-2])
for _ in range(int(input())):
	n = int(input())
	(lo, hi) = (0, len(fib))
	while lo < hi:
		mid = lo + hi >> 1
		if n <= fib[mid]:
			hi = mid
		else:
			lo = mid + 1
	if fib[lo] == n:
		print('YES')
	else:
		print('NO')


a = 0
b = 1
c = 10 ** 1000
z = set()
z.add(a)
z.add(b)
while a + b < c:
	(a, b) = (b, a + b)
	z.add(b)
h = int(input())
for i in range(h):
	n = int(input())
	if n in z:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = 0
	b = 1
	while b < n:
		c = a + b
		a = b
		b = c
	if b > n:
		print('NO')
	else:
		print('YES')


def bis(a, key, p, q):
	if q == p + 1 and a[p] != key:
		return False
	mid = (p + q) // 2
	if a[mid] == key:
		return True
	if a[mid] < key:
		return bis(a, key, mid, q)
	else:
		return bis(a, key, p, mid)
query = []
for _ in range(int(input())):
	query.append(int(input()))
maxi = max(query)
seq = [0, 1]
while seq[-1] + seq[-2] <= maxi:
	seq.append(seq[-1] + seq[-2])
lens = len(seq)
for i in query:
	if bis(seq, i, 0, lens):
		print('YES')
	else:
		print('NO')


a = 0
b = 1
tar = 10 ** 1000
s = set()
s.add(a)
s.add(b)
while a + b < tar:
	(a, b) = (b, a + b)
	s.add(b)
T = int(input())
for _ in range(T):
	n = int(input())
	if n in s:
		print('YES')
	else:
		print('NO')


t = int(input())
while t != 0:
	flag = 1
	f0 = 0
	f1 = 1
	a = [0, 1]
	for i in range(5000):
		(f1, f0) = (f1 + f0, f1)
		a.append(f1)
	n = int(input())
	if n in a:
		flag = 0
	else:
		flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')
	t -= 1


fib = list()
fib.append(0)
fib.append(1)
for i in range(2, 4810):
	temp = fib[i - 1] + fib[i - 2]
	fib.append(temp)
t = int(input())
for i in range(t):
	num = int(input())
	if num in fib:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	l = []
	n = int(input())
	l.append(0)
	l.append(1)
	for i in range(2, 6000):
		flag = 0
		if n == 1 or n == 2:
			flag = 1
		l.append(l[i - 1] + l[i - 2])
		if l[i] == n:
			flag = 1
			break
	if flag:
		print('YES')
	else:
		print('NO')


fibonacci = []

def get_fibonacci(num):
	b = 1
	a = 1
	while b < num:
		fibonacci.append(b)
		b = a + b
		a = fibonacci[-1]

def check_fibonacci(num):
	if num in fibonacci:
		return 'YES'
	return 'NO'
get_fibonacci(10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)
t = int(input())
for i in range(t):
	num = int(input())
	print(check_fibonacci(num))


import math
a = []
for test in range(int(input())):
	a = int(input())
	f = 0
	s = 1
	t = f + s
	check = 1
	for i in range(3, 10000):
		t = s + f
		if t == a:
			check = 0
			print('YES')
			break
		f = s
		s = t
	if check:
		print('NO')


fib_lst = [0, 1]
dic = {}
for i in range(2, 6000):
	fib_lst.append(fib_lst[i - 1] + fib_lst[i - 2])
for x in fib_lst:
	dic[x] = 1
for _ in range(int(input())):
	if int(input()) in dic:
		print('YES')
	else:
		print('NO')


a = 0
b = 1
cnt = 0
map = {}
map[0] = 1
map[1] = 1
for _ in range(5000):
	d = a + b
	b = a
	a = d
	map[d] = 1
tc = int(input())
for _ in range(tc):
	s = int(input())
	if s in map:
		print('YES')
	else:
		print('NO')


def is_fibonacci(n):
	a = 0
	b = 1
	while True:
		(a, b) = (b, a + b)
		if b >= n:
			if b == n:
				print('YES')
			else:
				print('NO')
			break
t = int(input())
for _ in range(t):
	n = int(input())
	is_fibonacci(n)


t = int(input())
for i in range(t):
	n = int(input())
	f1 = 0
	f2 = 1
	f3 = 0
	while f3 < n:
		f3 = f1 + f2
		(f1, f2) = (f2, f3)
		if f3 == n:
			flag = 1
			break
		else:
			flag = 0
	if flag == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	if n == 0:
		print('YES')
	else:
		f_prev = 0
		f_now = 1
		f_next = f_now + f_prev
		bool_var = 0
		while True:
			f_next = f_now + f_prev
			f_prev = f_now
			f_now = f_next
			if n == f_next:
				bool_var = 1
				break
			elif f_next > n:
				bool_var = 0
				break
		if bool_var:
			print('YES')
		else:
			print('NO')
	t -= 1


l = [0, 1]
a = 0
b = 1
for j in range(5000):
	(b, a) = (a + b, b)
	l.append(b)
for this in range(int(input())):
	n = int(input())
	if n in l:
		print('YES')
	else:
		print('NO')


def fib(n):
	n -= 1
	(a, b, c, d) = (1, 1, 1, 0)
	(x, y) = (1, 0)
	while n:
		if n % 2:
			(x, y) = (a * x + b * y, c * x + d * y)
		(a, b, c, d) = (a * a + b * c, a * b + b * d, c * a + d * c, c * b + d * d)
		n >>= 1
	return y
for _ in range(int(input())):
	a = int(input())
	(lo, hi) = (0, 9999)
	while lo < hi:
		m = (lo + hi) // 2
		if fib(m) < a:
			lo = m + 1
		else:
			hi = m
	print('YES' if fib(hi) == a else 'NO')


arr = set()
arr.add(0)
a = 0
b = 1
while len(str(b)) <= 1000:
	(b, a) = (a + b, b)
	arr.add(b)
for i in range(int(input())):
	N = int(input())
	if N in arr:
		print('YES')
	else:
		print('NO')


t = int(input())

def is_perfect_square(n):
	x = n // 2
	y = set([x])
	while x * x != n:
		x = (x + n // x) // 2
		if x in y:
			return False
		y.add(x)
	return True
while t > 0:
	n = int(input())
	ans1 = 5 * n * n - 4
	ans2 = 5 * n * n + 4
	if is_perfect_square(ans1) == True or is_perfect_square(ans2) == True:
		print('YES')
	else:
		print('NO')
	t = t - 1


dp = [0, 1, 1]
for i in range(3, 10005):
	dp.append(dp[i - 1] + dp[i - 2])
t = int(input())
for i in range(t):
	n = int(input())
	if n in dp:
		print('YES')
	else:
		print('NO')


mem = [0] * 5000

def makef():
	mem[1] = 1
	mem[2] = 2
	for i in range(3, 4785):
		mem[i] = mem[i - 1] + mem[i - 2]
makef()
t = int(input())
for _ in range(t):
	a = int(input())
	yes = 'NO'
	for i in range(4785):
		if mem[i] == a:
			yes = 'YES'
			break
	print(yes)


def check():
	f = 0
	s = 1
	c = f + s
	fib = {0: 1, 1: 1}
	while c < 10 ** 1001:
		(f, s) = (s, c)
		c = f + s
		fib[c] = 1
	input()
	import sys
	n = map(int, sys.stdin.read().split())
	for i in n:
		try:
			fib[i]
			print('YES')
		except:
			print('NO')
check()


import math
import sys
from collections import Counter, defaultdict
from bisect import bisect_left
mod = 1000000007

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

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

def hetro_list():
	return list(input().split())
lst = [0, 1]
while True:
	lst.append(lst[-1] + lst[-2])
	if len(str(lst[-1])) > 1000:
		break

def main():
	pass
t = int(input())
for _ in range(t):
	n = int(input())
	if n in lst:
		print('YES')
	else:
		print('NO')
	main()


def S(n):
	x = n
	y = 1
	e = 1e-45
	while x - y > e:
		x = (x + y) / 2
		y = n / x
	return x
fib = [0, 1]
p = 10 ** 4 + 9
for i in range(2, p):
	fib.append(fib[i - 1] + fib[i - 2])
for _ in range(int(input())):
	n = int(input())
	print('YES' if n in fib else 'NO')


def fib(n):
	l = [1, 1]
	j = 1
	while l[j] < n:
		j += 1
		x = l[j - 1] + l[j - 2]
		l.append(x)
	return l[-1]
t = int(input())
for _ in range(t):
	n = int(input())
	y = fib(n)
	if y == n:
		print('YES')
	else:
		print('NO')


lim = 10 ** 1000
l = [1, 1]
t = int(input())
while l[-1] < lim:
	l.append(l[-1] + l[-2])
for i in range(t):
	flag = False
	n = int(input())
	temp = 0
	while l[temp] <= n:
		if l[temp] == n:
			flag = True
			print('YES')
		temp += 1
	if not flag:
		print('NO')


myset = set([0, 1])
a = 0
b = 1
for i in range(0, 100000):
	c = a + b
	myset.add(c)
	a = b
	b = c
t = int(input())
for i in range(0, t):
	j = int(input())
	ans = j in myset
	if ans == 1:
		print('YES')
	else:
		print('NO')


T = int(input())
for k in range(T):
	n = int(input())
	first = 0
	second = 1
	while second < n:
		temp = first
		first = second
		second = second + temp
	if second == n:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	pr1 = 0
	pr2 = 1
	while True:
		tm = pr1
		pr1 = pr2
		pr2 = tm + pr2
		if pr2 == n:
			print('YES')
			fl = 1
			break
		elif pr2 > n:
			print('NO')
			break


t = int(input())

def fib2(n):
	result = []
	(a, b) = (0, 1)
	while b <= n:
		result.append(b)
		(a, b) = (b, a + b)
	return result
for _ in range(t):
	x = int(input())
	a = 0
	b = 1
	if x == a or x == b:
		print('YES')
	else:
		y = fib2(x)
		if x in y:
			print('YES')
		else:
			print('NO')


F = [0, 1]
for i in range(2, 10001):
	F.append(F[i - 1] + F[i - 2])
for _ in range(int(input())):
	n = int(input())
	print('YES') if n in F else print('NO')


l = [0, 1]
for i in range(2, 20001):
	l.append(l[i - 1] + l[i - 2])
t = int(input())
for item in range(t):
	n = int(input())
	if n in l:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = 1
	b = 1
	while b < n:
		a = a + b
		b = a + b
	if a != n and b != n:
		print('NO')
		continue
	print('YES')


import sys

def inp():
	return input()

def readInt():
	return int(inp())

def readList():
	return list(map(int, inp().strip().split(' ')))

def readStr():
	return inp().strip()

def makeMatrix(x, y, value):
	a = [0] * x
	for i in range(x):
		a[i] = [value] * y
	return a
f0 = 0
f1 = 1
a = [0, 1]
for i in range(5000):
	(f1, f0) = (f1 + f0, f1)
	a.append(f1)
tc = readInt()
while tc:
	tc -= 1
	x = readInt()
	if x in a:
		print('YES')
	else:
		print('NO')


import math
t = int(input())
fib = {0: True, 1: True}
b = 0
a = 1
while len(str(a)) <= 1000:
	c = a
	a = b + a
	b = c
	fib[a] = True
while t != 0:
	t -= 1
	n = int(input())
	if n in fib:
		print('YES')
	else:
		print('NO')


import math
_1_50 = 1 << 50

def isqrt(x):
	if x < 0:
		raise ValueError('square root not defined for negative numbers')
	if x < _1_50:
		return int(math.sqrt(x))
	n = int(x)
	if n <= 1:
		return n
	r = 1 << (n.bit_length() + 1 >> 1)
	while True:
		newr = r + n // r >> 1
		if newr >= r:
			return r
		r = newr

def is_perfect_suare(x):
	s = isqrt(x)
	return s * s == x
t = int(input())
while t:
	n = int(input())
	tmp = 5 * n * n
	if is_perfect_suare(tmp + 4) or is_perfect_suare(tmp - 4):
		print('YES')
	else:
		print('NO')
	t -= 1