You are given a positive integer $x$. Check whether the number $x$ is representable as the sum of the cubes of two positive integers.

Formally, you need to check if there are two integers $a$ and $b$ ($1 \le a, b$) such that $a^3+b^3=x$.

For example, if $x = 35$, then the numbers $a=2$ and $b=3$ are suitable ($2^3+3^3=8+27=35$). If $x=4$, then no pair of numbers $a$ and $b$ is suitable.


-----Input-----

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

Each test case contains one integer $x$ ($1 \le x \le 10^{12}$).

Please note, that the input for some test cases won't fit into $32$-bit integer type, so you should use at least $64$-bit integer type in your programming language.


-----Output-----

For each test case, output on a separate line:

"YES" if $x$ is representable as the sum of the cubes of two positive integers.

"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
7
1
2
4
34
35
16
703657519796
Output
NO
YES
NO
NO
YES
YES
YES


-----Note-----

The number $1$ is not representable as the sum of two cubes.

The number $2$ is represented as $1^3+1^3$.

The number $4$ is not representable as the sum of two cubes.

The number $34$ is not representable as the sum of two cubes.

The number $35$ is represented as $2^3+3^3$.

The number $16$ is represented as $2^3+2^3$.

The number $703657519796$ is represented as $5779^3+7993^3$.

Difficulty: EASY
Tags: Sorting

Mathematics

Complete search
Skill types: Sorting

Complete search

Starter code:

Solutions:
from sys import stdin, stdout, setrecursionlimit
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nlargest
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm, accumulate
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
setrecursionlimit(10 ** 9)
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return input()

def num():
	return int(input())

def L():
	return list(sp())

def LF():
	return list(spf())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def spf():
	return map(int, input.readline().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]

def pmat(A):
	for ele in A:
		print(*ele, end='\n')

def pmat2(A):
	for ele in A:
		for j in ele:
			print(j, end='')
		print()

def iseven(n):
	return n % 2 == 0

def seive(r):
	prime = [1 for i in range(r + 1)]
	prime[0] = 0
	prime[1] = 0
	for i in range(r + 1):
		if prime[i]:
			for j in range(2 * i, r + 1, i):
				prime[j] = 0
	return prime
s = set()
for i in range(1, 10001):
	s.add(i ** 3)
for _ in range(int(input())):
	n = int(input())
	ans = 'NO'
	for x in s:
		if n - x in s:
			ans = 'YES'
			break
	print(ans)
endtime = time.time()


import sys
r = sys.stdin.readline
dic = {}
for i in range(1, 10001):
	dic[i ** 3] = 1
for _ in range(int(r())):
	N = int(r())
	for i in dic.keys():
		if N - i in dic:
			print('YES')
			break
		elif i >= N:
			print('NO')
			break


from collections import defaultdict
prefix = defaultdict(int)
for i in range(1, 10000):
	prefix[i ** 3] = i
cache = defaultdict(str)
for i in range(int(input())):
	n = int(input())
	if n in cache:
		print(cache[n])
		continue
	for i in prefix:
		if n - i in prefix:
			print('YES')
			cache[n] = 'YES'
			break
	else:
		cache[n] = 'NO'
		print('NO')


n = int(input())
dic = {}
for i in range(1, 10001):
	dic[i ** 3] = 'm'

def cube(x):
	for i in dic:
		if x - i in dic:
			return 'YES'
	return 'NO'
for i in range(n):
	temp = int(input())
	print(cube(temp))


t = int(input())
for i in range(t):
	n = int(input())
	e = 0
	l = []
	if n == 1:
		print('NO')
	elif n == 2:
		print('YES')
	else:
		r = int(pow(n, 1 / 3)) + 1
		for k in range(1, r):
			l.append(int(pow(k, 3)))
		s = set()
		for i in range(0, len(l)):
			s.add(l[i])
			temp = n - l[i]
			if temp in s:
				print('YES')
				e = 1
				break
		if e == 0:
			print('NO')


t = int(input())
map_coub = []
dict_map = {}
list_x = [int(input()) for _ in range(t)]
max_x = max(list_x)
a = 1
while a * a * a <= max_x:
	map_coub.append(a * a * a)
	dict_map[a * a * a] = 0
	a += 1

def find_coub(x):
	for i in map_coub:
		if i > x:
			return False
		if x - i in dict_map:
			return True
	return False
for x in list_x:
	print('YES' if find_coub(x) else 'NO')


t = int(input())
arr = {int(i ** 3) for i in range(1, 10000)}
for _ in range(t):
	x = int(input())
	flag = 1
	for i in arr:
		if x - i in arr:
			print('YES')
			flag = 0
			break
	if flag:
		print('NO')


l = {i ** 3 for i in range(1, 10001)}
for _ in range(int(input())):
	x = int(input())
	for a in l:
		if x - a in l:
			print('YES')
			break
	else:
		print('NO')


import sys

def rr():
	return sys.stdin.readline().rstrip()
rp = print

def print(*args, **kwargs):
	rp('DBG:# ', *args, **kwargs, file=sys.stderr)

def rri():
	return int(rr())

def rrl():
	return list(map(int, rr().split()))

def rrt():
	return tuple(map(int, rr().split()))

def rrle():
	return (line.rstrip() for line in sys.stdin.readlines())

def rrtl():
	return [tuple(map(int, l.split())) for l in rrle()]
from collections import defaultdict

def mus(d=lambda : 0):
	return defaultdict(lambda : defaultdict(d))

def dd0(d=lambda : 0):
	return defaultdict(d)

def ms(x, y, d=0):
	return [[0] * y for i in range(x)]

def ar(x, d=0):
	return [d] * x

def ppm(m, n=0, x=0, y=0):
	print('\n'.join(('\t'.join((str(m[j][i]) for j in range(y or n))) for i in range(x or n))))

def ppa(a, n):
	print('\t'.join(map(str, a[0:n])))

def ppl(a=0, x=[1]):
	x[0] = a or x[0] + 1
	print('-' + '- -' * 14 + '-# ' + str(x[0] - 2) + ' #-' + '- -' * 14 + '-')

def fltn(a):
	(i for sub in a for i in sub)

def yn(x):
	return 'YES' if x else 'NO'
from itertools import tee
from itertools import accumulate
from itertools import groupby
from itertools import permutations

def pairwise(iterable):
	(a, b) = tee(iterable)
	next(b, None)
	return zip(a, b)

def grp(x, key=None):
	return ((i, sum((1 for _ in g))) for (i, g) in groupby(x, key=key))
import math

def rnar():
	return (*rrl(), rrl())

def rn():
	return (*rrl(),)

def dpp(a, b=''):
	print('#| {} |#:^ {} ^:'.format(a, b))

def str_join(i, sep=' '):
	return sep.join(map(str, i))
MOD17 = 10 ** 9 + 7

def read():
	n = rri()
	return (n,)

def is_cube(x):
	return round(x ** (1 / 3)) ** 3 == x

def solve(n):
	if n == 1:
		return 'NO'
	for i in range(1, math.ceil(n ** (1 / 3))):
		if n - i ** 3 <= 0:
			break
		if is_cube(n - i ** 3):
			return 'YES'
	return 'NO'
test_count = rri()
for _ in range(test_count):
	input_data = read()
	result = solve(*input_data)
	rp(result)


from sys import stdin
input = lambda : stdin.readline().strip()
lin = lambda : list(map(int, input().split()))
iin = lambda : int(input())
main = lambda : map(int, input().split())
from math import ceil, sqrt, factorial, log
from collections import deque
from bisect import bisect_left
mod = 998244353
mod = 1000000007

def gcd(a, b):
	(a, b) = (max(a, b), min(a, b))
	while a % b != 0:
		(a, b) = (b, a % b)
	return b

def moduloinverse(a):
	return pow(a, mod - 2, mod)

def solve(we):
	x = iin()
	flag = 'NO'
	for i in range(1, 10 ** 4 + 3):
		t = i * i * i
		if t < x:
			z = int(pow(x - t, 1 / 3))
			if z * z * z + t == x:
				flag = 'YES'
				break
			elif pow(z + 1, 3) + t == x:
				flag = 'YES'
				break
		else:
			break
	print(flag)
qwe = 1
qwe = iin()
for _ in range(qwe):
	solve(_ + 1)


import io
import os
from collections import Counter, defaultdict, deque
cubes = set((x * x * x for x in range(1, 10 ** 4)))

def solve(X):
	for c in cubes:
		if X - c in cubes:
			return 'YES'
	return 'NO'
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
TC = int(input())
for tc in range(1, TC + 1):
	(X,) = [int(x) for x in input().split()]
	ans = solve(X)
	print(ans)


import math

def checkCube(x):
	try:
		if x == 0:
			return False
		croot = round(x ** (1 / 3))
		if croot * croot * croot == x:
			return True
		return False
	except:
		return False
for t in range(int(input())):
	n = int(input())
	end = math.ceil(n ** (1 / 3))
	flag = 0
	for i in range(1, end + 1):
		z = math.floor(i ** 3)
		if checkCube(n - z):
			flag = 1
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')


s = {i ** 3 for i in range(1, 10001)}
for _ in range(int(input())):
	n = int(input())
	b = 1
	for i in s:
		if n - i in s:
			b = 0
			break
	print('YNEOS'[b::2])


array = {i ** 3 for i in range(1, 10001)}
for _ in range(int(input())):
	x = int(input())
	flag = False
	for a in array:
		if x - a in array:
			flag = True
			break
	if flag:
		print('YES')
	else:
		print('NO')


def perfectCube(N):
	if N == 0:
		return False
	cube_root = round(N ** (1 / 3))
	if cube_root * cube_root * cube_root == N:
		return True
	else:
		return False
for i in range(int(input())):
	x = int(input())
	b = 1
	flag = 1
	while True:
		if x - b * b * b <= 0:
			break
		if perfectCube(x - b * b * b):
			flag = 0
			print('YES')
			break
		b += 1
	if flag == 1:
		print('NO')


import os
import sys
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')

def main():
	s = {pow(i, 3): None for i in range(1, 10000)}
	for _ in range(int(input())):
		n = int(input())
		f = 1
		lim = int(pow(n, 1 / 3)) + 1
		for i in range(1, lim):
			b = n - pow(i, 3)
			if b > 0 and b in s:
				print('YES')
				f = 0
				break
		if f:
			print('NO')
	return
main()


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
import string
ORDA = 97

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

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

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True
ans = []
for _ in range(ii()):
	x = ii()
	for i in range(1, math.ceil(math.pow(x, 1 / 3))):
		y = math.ceil(math.pow(x - i ** 3, 1 / 3))
		if i ** 3 + y ** 3 == x and y > 0:
			ans.append('YES')
			break
	else:
		ans.append('NO')
print(*ans, sep='\n')


from os import path
import sys, time
from math import ceil, floor, gcd, log, log2, factorial, sqrt
from collections import defaultdict, Counter, OrderedDict, deque
from functools import reduce
from operator import mul
maxx = float('inf')
I = lambda : int(sys.stdin.buffer.readline())
tup = lambda : map(int, sys.stdin.buffer.readline().split())
lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
S = lambda : sys.stdin.readline().strip('\n')
grid = lambda r: [lint() for i in range(r)]
stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
localsys = 0
start_time = time.time()
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
for _ in range(I()):
	n = I()
	s = {i ** 3 for i in range(1, 10001)}
	for i in s:
		if n - i in s:
			print('YES')
			break
	else:
		print('NO')
if localsys:
	print('\n\nTime Elased :', time.time() - start_time, 'seconds')


t = int(input())
c = {i ** 3 for i in range(1, 10001)}
for _ in range(t):
	x = int(input())
	for j in c:
		if x - j in c:
			print('YES')
			break
	else:
		print('NO')


from math import floor, ceil

def croot(x):
	return x ** (1 / 3)

def perf_cube(x):
	x = abs(x)
	return int(round(x ** (1.0 / 3))) ** 3 == x

def rep(n):
	if n == 1:
		return 'NO'
	temp = floor(croot(n))
	if n - temp ** 3 == 0:
		temp -= 1
	while temp > 0:
		if perf_cube(n - temp ** 3) == True:
			return 'YES'
		else:
			temp -= 1
	return 'NO'
for _ in range(int(input())):
	n = int(input())
	print(rep(n))


s = {i ** 3 for i in range(1, 10 ** 4 + 1)}
t = int(input())
for _ in range(t):
	x = int(input())
	for i in s:
		if x - i in s:
			print('YES')
			break
	else:
		print('NO')


d = set()
for i in range(1, 10000):
	d.add(i ** 3)
t = int(input())
for k in range(t):
	x = int(input())
	n = int(x ** (1 / 3)) + 1
	pr = 0
	for i in range(1, n):
		if x - i ** 3 in d:
			pr = 1
			break
	if pr == 1:
		print('YES')
	else:
		print('NO')


import sys
import math
input = sys.stdin.readline

def cube_root(x):
	return round(math.pow(x, 1 / 3))
t = int(input())
for w in range(t):
	n = int(input())
	c = 0
	i = 0
	j = 0
	s = 0
	if n == 1:
		print('NO')
	else:
		for i in range(1, 100001):
			if n - i * i * i == 1:
				c = 1
				break
			if n - i * i * i <= 0:
				break
			k = cube_root(n - i * i * i)
			if k * k * k == n - i * i * i:
				c = 1
				break
		if c:
			print('YES')
		else:
			print('NO')


from collections import defaultdict

def fuck(n):
	return n ** (1 / 3)
for _ in range(int(input())):
	n = int(input())
	h = defaultdict(int)
	c = 0
	for i in range(1, int(fuck(n)) + 1, 1):
		lol = i * i * i
		h[lol] = 1
		if h[n - lol] == 1:
			print('YES')
			c = 1
			break
	if c == 0:
		print('NO')


se = set()
for i in range(1, 10010):
	se.add(i ** 3)

def main():
	n = int(input())
	for s in se:
		if n - s in se:
			print('YES')
			return
	print('NO')
for _ in range(int(input())):
	main()


t = int(input())
a = set()
for i in range(1, 10000):
	a.add(i ** 3)
for i in range(t):
	n = int(input())
	res = 0
	for iii in a:
		if n - iii in a:
			res = 1
			break
	if res == 0:
		print('NO')
	else:
		print('YES')


s = set()
for i in range(1, 10001):
	s.add(i * i * i)
t = int(input())
for _ in range(t):
	n = int(input())
	i = 1
	flag = False
	while i * i * i < n:
		if n - i * i * i in s:
			flag = True
			break
		i += 1
	if flag:
		print('YES')
	else:
		print('NO')


import math
for tt in range(int(input())):
	x = int(input())
	b = False
	for i in range(1, x):
		if i * i * i >= x:
			break
		o = x - i * i * i
		j = round(o ** (1 / 3))
		if j * j * j == o:
			print('YES')
			b = True
			break
	if not b:
		print('NO')


from sys import stdin
from math import ceil, floor
input = stdin.readline

def help():
	n = int(input())
	for i in range(1, 10100):
		temp = n - i ** 3
		if temp <= 0:
			break
		if ceil(temp ** (1 / 3.0)) ** 3 == temp or floor(temp ** (1 / 3.0)) == temp:
			print('YES')
			return
	print('NO')
for _ in range(int(input().strip())):
	help()


import math
spi = []
for i in range(1, 10000):
	spi.append(i * i * i)
an = []
i = 0
t = int(input())
for el in range(t):
	n = int(input())
	re = 'no'
	i = 0
	while i < 9999 and spi[i] < n:
		if round(math.pow(n - spi[i], 1 / 3.0)) ** 3 == n - spi[i]:
			re = 'yes'
			break
		i += 1
	print(re)


tests = int(input())
arr = set()
for i in range(1, 10001):
	arr.add(i ** 3)
for _ in range(tests):
	n = int(input())
	true = False
	for x in arr:
		if n - x in arr:
			true = True
			break
	if true:
		print('YES')
	else:
		print('NO')


t = int(input())
d = []
for i in range(1, 10 ** 4 + 1):
	d.append(i ** 3)
P = set(d)
for i in range(t):
	x = int(input())
	f = 0
	for j in range(1, 10 ** 4 + 1):
		if x - j ** 3 in P:
			f += 1
			print('YES')
			break
	if f == 0:
		print('NO')


def main():
	x = input()
	integers = []
	for _ in range(int(x)):
		integers.append(int(input()))
	cubes_sorted = [x ** 3 for x in range(1, 10000)]
	cubes = set(cubes_sorted)
	for integer in integers:
		found = False
		for cube in cubes_sorted:
			if cube > integer:
				break
			if integer - cube in cubes:
				found = True
				break
		if found:
			print('YES')
		else:
			print('NO')
main()


def checkCube(n):
	cb_rt = round(n ** (1 / 3))
	return cb_rt * cb_rt * cb_rt == n
t = int(input())
for _ in range(t):
	num = int(input())
	cb = 0
	i = 1
	flag = 0
	while i < num:
		cb = i ** 3
		if num - cb > 0:
			if checkCube(num - i ** 3):
				flag = 1
				print('YES')
				break
			i += 1
		else:
			break
	if flag == 0:
		print('NO')


def cube_root(n):
	(start, end) = (0, n)
	while True:
		mid = (start + end) / 2
		midc = mid ** 3
		if abs(n - midc) < 0.1:
			return int(mid)
		if midc > n:
			end = mid
		if midc < n:
			start = mid
t = int(input())
for case in range(t):
	n = int(input())
	start = 1
	end = cube_root(n)
	f = False
	while start <= end:
		ncub = start ** 3 + end ** 3
		if ncub > n:
			end -= 1
		elif ncub < n:
			start += 1
		else:
			f = True
			break
	if f:
		print('yes')
	else:
		print('no')


import math

def getlist():
	return [int(i) for i in input().split()]

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

def getstr():
	return [str(i) for i in input().split()]
l = []
for a in range(1, 10000):
	l.append(a ** 3)
s = set(l)

def solve():
	x = int(input())
	for i in l:
		if x - i in s:
			print('YES')
			break
	else:
		print('NO')
for _ in range(int(input())):
	solve()


def foo(x):
	a = 1
	while 2 * a ** 3 <= x:
		b3 = x - a ** 3
		b = round(b3 ** (1 / 3))
		if a ** 3 + b ** 3 == x:
			return True
		a += 1
	return False

def main():
	t = int(input())
	for case in range(t):
		x = int(input())
		print('YES' if foo(x) else 'NO')
main()


import math
t = int(input())
for k in range(t):
	x = int(input())
	i = 1
	pr = 0
	while i * i * i <= x:
		a = (x - i * i * i) ** (1 / 3)
		a = math.ceil(a)
		if a ** 3 + i ** 3 == x and a >= 1:
			pr = 1
			break
		i += 1
	if pr == 1:
		print('YES')
	else:
		print('NO')


def f(n, L):
	for Num in L:
		if n - Num in L:
			return 'YES'
	return 'NO'
t = int(input())
L = {i ** 3 for i in range(1, 10001)}
for _ in range(t):
	n = int(input())
	print(f(n, L))


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

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

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
md1 = {}
md2 = {}
for i in range(2, 10003, 2):
	md1[i ** 3] = 1
for i in range(1, 10003, 2):
	md2[i ** 3] = 1
for _ in range(int(inp())):
	n = iinp()
	t = False
	if n % 2 == 0:
		for i in md1.keys():
			if n - i in md1:
				t = True
				break
		if t:
			print('YES')
			continue
		for i in md2.keys():
			if n - i in md2:
				t = True
				break
		print('YES' if t else 'NO')
	else:
		for i in md1.keys():
			if n - i in md2:
				t = True
				break
		print('YES' if t else 'NO')


cubes = {a ** 3 for a in range(1, 10001)}
t = int(input())
while t > 0:
	n = int(input())
	res = 'NO'
	for a in cubes:
		if n - a in cubes:
			res = 'YES'
			break
	print(res)
	t -= 1


t = int(input())
from math import floor, ceil
for _ in range(t):
	n = int(input())
	l = []
	for i in range(1, 20001):
		l.append(int(pow(i, 3)))
	flag = False
	for i in range(len(l)):
		x = l[i]
		if x < n:
			y = n - x
			cr = round(y ** (1 / 3))
			if cr * cr * cr + x == n:
				flag = True
				break
		else:
			break
	if flag:
		print('YES')
	else:
		print('NO')


s = set()
for i in range(1, 10001):
	s.add(i * i * i)

def fun():
	n = int(input())
	ans = 'NO'
	for cube in s:
		if n - cube in s:
			ans = 'YES'
	return ans
t = int(input())
for i in range(t):
	print(fun())


cu = {i * i * i for i in range(1, 10001)}
t = int(input())
for i in range(t):
	n = int(input())
	for i in cu:
		if n - i in cu:
			print('YES')
			break
	else:
		print('NO')


import os
import sys
from collections import defaultdict
from math import ceil
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')
readint = lambda : int(sys.stdin.readline().rstrip('\r\n'))
readints = lambda : map(int, sys.stdin.readline().rstrip('\r\n').split())
readstr = lambda : sys.stdin.readline().rstrip('\r\n')
readstrs = lambda : map(str, sys.stdin.readline().rstrip('\r\n').split())
readarri = lambda : [int(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]
readarrs = lambda : [str(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]
mod = 998244353
MOD = int(1000000000.0) + 7
N = int(1000000000000.0)
stores = [i * i * i for i in range(1, int(N ** (1 / 3)) + 1)]
mapp = defaultdict(int)
for i in stores:
	mapp[i] = 1

def solve():
	n = readint()
	for i in stores:
		if mapp[n - i]:
			print('YES')
			return
	print('NO')

def main():
	t = 1
	t = readint()
	for _ in range(t):
		solve()
main()


cs = set()
for x in range(1, 10001):
	cs.add(x * x * x)
for _ in range(int(input())):
	j = int(input())
	ans = 'NO'
	for i in cs:
		if j - i in cs:
			ans = 'YES'
	print(ans)


s = {i ** 3 for i in range(1, 10001)}
for _ in range(int(input())):
	n = int(input())
	print('NYOE S'[any((n - i in s for i in s))::2])


ls = set()
for i in range(1, 10000):
	ls.add(i ** 3)
for _ in range(int(input())):
	x = int(input())
	ans = 'NO'
	for i in ls:
		if x - i in ls:
			ans = 'YES'
			break
	print(ans)


y = {}
y = set()
for i in range(1, 10001):
	y.add(i ** 3)
for _ in range(int(input())):
	x = int(input())
	for j in y:
		if x - j in y:
			print('YES')
			break
	else:
		print('NO')


def solve(x):
	for i in l:
		if i > x:
			break
		if x - i in lset:
			print('YES')
			return
	print('NO')
l = []
cur = 1
while cur ** 3 <= 10000000000000.0:
	l.append(cur ** 3)
	cur += 1
lset = set(l)
t = int(input())
for _ in range(t):
	solve(int(input()))


t = int(input())
for _ in range(t):
	x = int(input())
	ans = 0
	s = set()
	for i in range(1, 10001):
		s.add(i ** 3)
	for i in range(1, 10001):
		if x - i ** 3 in s:
			ans = 1
			break
	print('YES' if ans else 'NO')


def sqrt3(n):
	return n ** (1 / 3)
r = set((int(i) ** 3 for i in range(1, 10000)))
t = int(input())
for _ in range(t):
	x = int(input())
	for i in r:
		if x - i in r:
			print('YES')
			break
	else:
		print('NO')


import sys, os.path
from math import ceil, floor
if os.path.exists('in'):
	sys.stdin = open('in', 'r')
	sys.stdout = open('out', 'w')
for _ in range(int(input())):
	n = int(input())
	if n < 10:
		cb_n = n
	else:
		cb_n = round(n ** (1 / 3))
	f = True
	for i in range(1, cb_n):
		x = i * i * i
		if x >= n:
			break
		x = (n - x) ** (1 / 3)
		if floor(x) == ceil(x):
			f = False
			print('yes')
			break
		else:
			x = round(x)
			if i * i * i + x * x * x == n:
				print('yes')
				f = False
				break
	if f:
		print('no')


import sys
input = sys.stdin.readline
import math

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

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

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

def invr():
	return map(int, input().split())
for _ in range(inp()):
	x = inp()
	for i in range(1, 10001):
		if x - i ** 3 <= 0:
			print('NO')
			break
		k = x - i ** 3
		r = round(k ** (1 / 3))
		if r * r * r == k:
			print('YES')
			break


import math
from collections import defaultdict
from math import comb
NO = 'NO'
YES = 'YES'
MOD = 1000000007

def input_int():
	return int(input())

def input_list():
	return input().split(' ')

def input_list_int():
	return list(map(int, input_list()))

def z_func(s):
	n = len(s)
	z = [0] * n
	l = r = 0
	for i in range(1, n):
		if r >= i:
			z[i] = min(z[i - l], r - i + 1)
		while z[i] + i < n and s[z[i]] == s[z[i] + i]:
			z[i] += 1
		if i + z[i] - 1 > r:
			l = i
			r = i + z[i] - 1
	return z
global_ans = []

def p(line):
	global_ans.append(line)
tmp = {}
for i in range(1, 11000):
	tmp[i * i * i] = 1

def solve():
	x = input_int()
	for i in tmp.keys():
		v = x - i
		if v in tmp:
			p(YES)
			return
	p(NO)
query_count = 1
query_count = input_int()
while query_count:
	query_count -= 1
	solve()
for global_ans_line in global_ans:
	print(global_ans_line)


try:
	k = set()
	for i in range(1, 10001):
		k.add(i * i * i)
	t = int(input())
	for i in range(0, t):
		n = int(input())
		flag = 0
		for i in k:
			if n - i in k:
				flag = 1
				break
		if flag == 1:
			print('YES')
		else:
			print('NO')
except:
	pass


test_cases = int(input())
cubes = {x ** 3 for x in range(1, 10001)}
values = [x ** 3 for x in range(1, 10001)]

def handle():
	x = int(input())
	for value in values:
		if value >= x:
			break
		remainder = x - value
		if remainder in cubes:
			return 'YES'
	return 'NO'
for _ in range(test_cases):
	print(handle())


import sys

def isqubic(x):
	(l, r) = (1, 10000 + 1)
	while r - l > 1:
		m = (r + l) // 2
		if m * m * m <= x:
			l = m
		else:
			r = m
	return l * l * l == x

def solve(x):
	for a in range(1, 10000 + 2):
		b = x - a * a * a
		if b <= 0:
			break
		if isqubic(b):
			return 'yes'
	return 'no'
t = int(input())
print('\n'.join((solve(x) for x in map(int, sys.stdin.read().split()))))


import sys
inputlines = sys.stdin.readlines()
number_of_testcases = int(inputlines[0])
N = 10 ** 12

def make_cube_root_set():
	cube_root_set = set()
	i = 1
	cube = i ** 3
	while cube < N:
		cube_root_set.add(cube)
		i += 1
		cube = i ** 3
	return cube_root_set
for i in range(number_of_testcases):
	possible_sum_of_cubes = int(inputlines[i + 1])
	j = 1
	cube = j ** 3
	cube_root_set = make_cube_root_set()
	while cube < possible_sum_of_cubes:
		if possible_sum_of_cubes - cube in cube_root_set:
			print('YES')
			break
		j += 1
		cube = j ** 3
	if cube >= possible_sum_of_cubes:
		print('NO')


import sys
input = sys.stdin.readline
d = {i ** 3 for i in range(1, 10 ** 4)}
for _ in range(int(input())):
	n = int(input())
	for i in d:
		if n - i in d:
			print('YES')
			break
	else:
		print('NO')


num_set = set()
for i in range(1, 10001):
	num_set.add(i ** 3)
for t in range(int(input())):
	n = int(input())
	for i in num_set:
		if n - i in num_set:
			print('YES')
			break
	else:
		print('NO')


a = {i ** 3 for i in range(1, 10001)}
for t in range(int(input())):
	x = int(input())
	for n in a:
		if x - n in a:
			print('YES')
			break
	else:
		print('NO')


import math
g = int(input())
for i in range(g):
	f = int(input())
	l = 1
	if f == 1:
		print('NO')
	elif f == 2:
		print('YES')
	elif f >= 3:
		for i in range(1, round(f ** (1 / 3))):
			k = i * i * i
			m = f - k
			n = round(m ** (1 / 3))
			if i * i * i + n * n * n == f:
				print('YES')
				break
			else:
				l += 1
		if l == round(f ** (1 / 3)):
			print('NO')


def is_perfect_cube(number) -> bool:
	if number == 0:
		return False
	else:
		return round(number ** (1 / 3)) ** 3 == number
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print('NO')
	else:
		for i in range(1, int(pow(n, 1 / 3)) + 1):
			x = n - i * i * i
			if is_perfect_cube(x):
				print('YES')
				break
		else:
			print('NO')


import math as mt

def is_perfect_cube(x):
	x = abs(x)
	return int(round(x ** (1.0 / 3))) ** 3 == x
for _ in range(int(input())):
	a = int(input())
	flag = 0
	for i in range(1, 10001):
		b = a - i ** 3
		if b < 1:
			continue
		if is_perfect_cube(b) == True:
			print('YES')
			flag = 1
			break
	if flag == 0:
		print('NO')


for t in range(int(input())):
	flag = 'NO'
	x = int(input())
	for a in range(1, int(x ** (1 / 3)) + 1):
		k = (x - a ** 3) ** (1 / 3)
		if round(k) ** 3 + a ** 3 == x and int(k) > 0:
			flag = 'YES'
			break
	print(flag)


t = int(input())
X = [int(input()) for _ in range(t)]

def f_slllooooww(x):
	for a in range(1, int(x ** (1 / 3)) + 1):
		for b in range(1, int(x ** (1 / 3)) + 1):
			if (a + b) % x == 0:
				if a ** 3 + b ** 3 == x:
					print('YES')
					return True
	print('NO')
	return False
cubes = {x ** 3 for x in range(1, 10000)}

def f(x):
	cube_root_of_x = x ** (1 / 3)
	for a in cubes:
		if x - a in cubes:
			print('YES')
			return True
	print('NO')
	return False
for x in X:
	f(x)


import math
import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	yup = False
	for i in range(1, 10005):
		b = n - i ** 3
		if b <= 0:
			break
		if int(round(b ** (1 / 3))) ** 3 == b:
			yup = True
			break
	if yup:
		print('Yes')
	else:
		print('No')


for t in range(int(input())):

	def sumSquare(n):
		s = dict()
		for i in range(n):
			if i * i * i >= n:
				break
			s[i * i * i] = 1
			if n - i * i * i in s.keys():
				return True
		return False
	n = int(input())
	if sumSquare(n):
		print('YES')
	else:
		print('NO')


import sys
from sys import stdin, stdout
from math import *
from collections import *
from itertools import *
int_arr = lambda : list(map(int, stdin.readline().strip().split()))

def solve(n):
	flag = 0
	for i in lis:
		if n - i in lis:
			flag = 1
			break
	print('YES' if flag else 'NO')
lis = set([i ** 3 for i in range(1, 10000)])
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	solve(n)


def d(n):
	for i in range(1, int(pow(n, 1 / 3)) + 1):
		a = i * i * i
		bc = n - a
		if bc > 0:
			if int(round(bc ** (1.0 / 3))) ** 3 == bc:
				return 'YES'
	return 'NO'
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print('NO')
	else:
		print(d(n))


arr = set()
for i in range(1, 10 ** 4):
	arr.add(i ** 3)
t = int(input())
for i in range(t):
	x = int(input())
	for i in arr:
		if x - i in arr:
			print('yes')
			break
	else:
		print('no')


def cube_r(x):
	x = abs(x)
	return int(round(x ** (1.0 / 3)))
from sys import stdin
t = int(stdin.readline())
for z in range(t):
	n = int(stdin.readline())
	f = 0
	if n == 1:
		f = 1
		print('NO')
	else:
		large = cube_r(n)
		small = 1
		while small <= large:
			if small ** 3 + large ** 3 == n:
				f = 1
				break
			elif small ** 3 + large ** 3 < n:
				small += 1
			else:
				large -= 1
		if f:
			print('Yes')
		else:
			print('No')


def main():
	arr = {i ** 3 for i in range(1, 10001)}
	for t in range(int(input())):
		n = int(input())
		found = False
		for a in arr:
			if n - a in arr:
				found = True
				break
		if found:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
while t:
	t -= 1
	x = int(input())
	a = set()
	for i in range(1, 10000):
		a.add(i ** 3)
	for j in a:
		if x - j in a:
			print('YES')
			break
	else:
		print('NO')


from collections import defaultdict, Counter, deque
from math import sqrt, log10, log, floor, factorial, gcd
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations
import sys, io, os
input = sys.stdin.readline
inf = float('inf')
mod = 10 ** 9 + 7

def yn(a):
	print('YES' if a else 'NO')
ceil = lambda a, b: (a + b - 1) // b
s = {i ** 3 for i in range(1, 10 ** 4 + 1)}
t = int(input())
for i in range(t):
	n = int(input())
	for i in s:
		if n - i in s:
			print('YES')
			break
	else:
		print('NO')


import math
from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	cur = 1
	d = {}
	while cur * cur * cur <= n:
		d[cur * cur * cur] = cur
		cur += 1
	ans = 'NO'
	for v in d:
		if n - v in d:
			ans = 'YES'
			break
	print(ans)


import math

def check(n):
	if n <= 0:
		return False
	a = n ** (1 / 3)
	a = math.ceil(a)
	if a * a * a == n:
		return True
	return False
for i in range(int(input())):
	n = int(input())
	flag = 0
	for j in range(1, 10001):
		if check(n - j * j * j):
			flag = 1
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


import math
import sys

class IO:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(sep=' '):
		return input().split(sep)

	@staticmethod
	def list_int(sep=' '):
		return list(map(int, input().split(sep)))

	@staticmethod
	def implode(sep, array):
		return sep.join((str(x) for x in array))
arr = {}
for i in range(1, 10010):
	arr[i ** 3] = 1

def solve():
	x = IO.int()
	ans = 'NO'
	for val in arr.keys():
		y = x - val
		if y in arr:
			ans = 'YES'
			break
	print(ans)
query_count = IO.int()
while query_count:
	query_count -= 1
	solve()


for i in range(int(input())):
	n = int(input())
	j = 1
	works = False
	while not j * j * j > n:
		aux = n - j ** 3
		if int(round(aux ** (1.0 / 3)) ** 3) == aux:
			if not aux == 0:
				works = True
				break
		j += 1
	if works:
		print('YES')
	else:
		print('NO')


import time, math as mt, bisect as bs, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
from collections import defaultdict
pi = 3.141592653589793

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

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

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

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def readTree(n, e):
	adj = [set() for i in range(n + 1)]
	for i in range(e):
		(u1, u2) = IP()
		adj[u1].add(u2)
	return adj

def sieve():
	li = [True] * (10 ** 3 + 5)
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	(prime, cur) = ([0] * 200, 0)
	for i in range(10 ** 3 + 5):
		if li[i] == True:
			prime[cur] = i
			cur += 1
	return prime

def SPF():
	mx = 10 ** 6 + 1
	spf[1] = 1
	for i in range(2, mx):
		if spf[i] == 1000000000.0:
			spf[i] = i
			for j in range(i * i, mx, i):
				if i < spf[j]:
					spf[j] = i
	return

def prime(n, d):
	prm = set()
	while n != 1:
		prm.add(spf[n])
		n = n // spf[n]
	for ele in prm:
		d[ele] = d.get(ele, 0) + 1
	return
mod = 998244353
inf = 10000000000000000

def solve():
	x = II()
	d = {}
	for i in range(1, 10 ** 4):
		d[i ** 3] = 1
	for i in range(1, 10 ** 4):
		if i ** 3 >= x:
			break
		diff = x - i ** 3
		if d.get(diff, -1) != -1:
			print('YES')
			return
	print('NO')
	return
t = II()
for i in range(t):
	solve()


t = int(input())
cubes = set()
for i in range(1, 10001):
	cubes.add(i ** 3)
for _ in range(t):
	x = int(input())
	i = 1
	result = 'YES'
	for i in range(1, 10001):
		other = x - i ** 3
		if other <= 0:
			result = 'NO'
			break
		if other in cubes:
			break
	print(result)


a = {i ** 3 for i in range(1, 10001)}
for _ in range(int(input())):
	x = int(input())
	valor = False
	for i in a:
		if x - i in a:
			print('YES')
			valor = True
			break
	if valor == False:
		print('NO')


from sys import stdin
t = int(stdin.readline())
val = set()
for i in range(1, 10001):
	val.add(i * i * i)
for _ in range(t):
	n = int(stdin.readline())
	flag = False
	i = 1
	while i * i * i < n:
		if n - i * i * i in val:
			flag = True
			break
		i += 1
	if flag:
		print('Yes')
	else:
		print('NO')


def number():
	return int(input())
hash = {}
for i in range(1, 10001):
	hash[i * i * i] = True

def f(n):
	for item in hash:
		if n - item in hash:
			return 'YES'
	return 'NO'
for i in range(number()):
	print(f(number()))


import sys

def main():
	input = sys.stdin.readline
	l = [i ** 3 for i in range(1, 10000)]
	s = set(l)
	for _ in range(int(input())):
		(x, res) = (int(input()), 'NO')
		for a in l:
			b = x - a
			if b < a:
				break
			elif b in s:
				res = 'YES'
				break
		print(res)
main()


cubes = {i ** 3 for i in range(1, 10001)}
t = int(input())
while t:
	t -= 1
	n = int(input())
	flag = 0
	for cube in cubes:
		if n - cube in cubes:
			flag = 1
			print('YES')
			break
	if flag == 0:
		print('NO')


a = {i ** 3 for i in range(1, 10001)}
for s in [*open(0)][1:]:
	n = int(s)
	for x in a:
		if n - x in a:
			print('YES')
			break
	else:
		print('NO')


def cubes():
	n = 1
	while True:
		yield (n ** 3)
		n += 1

def solve(n):
	for a in cubes():
		if a >= n:
			return 'NO'
		b = n - a
		b_base = round(b ** (1 / 3))
		if b_base ** 3 == b:
			return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	print(solve(n))


t = int(input())
while t:
	n = int(input())
	i = 1
	j = 10 ** 4
	flag = 0
	while i <= j:
		a = i ** 3
		b = j ** 3
		if a + b == n:
			flag = 1
			break
		elif a + b > n:
			j -= 1
		else:
			i += 1
	if flag:
		print('YES')
	else:
		print('NO')
	t -= 1


def findall():
	s = set()
	arr = []
	for i in range(1, 10001):
		k = i ** 3
		s.add(k)
		arr.append(k)
	return (s, arr)

def solve(s, arr):
	x = int(input())
	for i in range(10000):
		t = x - arr[i]
		if t in s:
			return 'YES'
	return 'NO'

def main():
	(s, arr) = findall()
	for _ in range(int(input())):
		print(solve(s, arr))
main()


n = int(input())
a = set()
for i in range(1, 10001):
	a.add(i ** 3)
for _ in range(n):
	x = int(input())
	ans = 'NO'
	for i in a:
		if x - i in a:
			ans = 'YES'
	print(ans)


cbs = set([i * i * i for i in range(1, 10 ** 4 + 1)])
for i in range(int(input())):
	x = int(input())
	for j in cbs:
		if x - j in cbs:
			print('YES')
			break
	else:
		print('NO')


kubs = {i * i * i for i in range(1, 10001)}
for i in range(int(input())):
	a = int(input())
	f = False
	for cnt in kubs:
		if a - cnt in kubs:
			f = True
			break
	if f:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = 'NO'
	for i in range(1, 10 ** 4):
		if i ** 3 < n and i ** 3 + round((n - i ** 3) ** (1 / 3)) ** 3 == n:
			a = 'YES'
	print(a)


get_line = lambda type_: list(map(type_, input().strip().split()))
my_set = {i ** 3 for i in range(1, 10000)}

def solve():
	x = int(input())
	for num in my_set:
		if x - num in my_set:
			print('YES')
			return
	print('NO')
t = int(input())
for _ in range(t):
	solve()


def get_t():
	s = set()
	for i in range(1, 10000):
		s.add(i * i * i)
	return s

def solve():
	pass
	n = int(input())
	f = 0
	for i in cube_set:
		if n - i in cube_set:
			print('YES')
			f = 1
			break
	if not f:
		print('NO')
T = int(input())
cube_set = get_t()
while T:
	T -= 1
	solve()


v = {i ** 3 for i in range(1, 10001)}

def cal(x):
	w = {x - i for i in v}
	return not w & v
for _ in range(0, int(input())):
	x = int(input())
	print(['NO', 'YES'][not cal(x)])


for i in range(int(input())):
	x = int(input())
	z = 0
	for a in range(int(x ** (1 / 3)), 0, -1):
		b = (x - a ** 3) ** (1 / 3)
		if abs(b - round(b)) <= 1 / 1000000000 and b != 0:
			z = 1
			break
	if z == 1:
		print('YES')
	else:
		print('NO')


import math
from collections import defaultdict
DEBUG = True

def log(*args, **kwargs):
	if DEBUG:
		print(*args, **kwargs)

def rint():
	return int(input())

def rlist(f=int):
	return list(map(f, input().split()))

def rstr():
	return input()

class Solution:

	def __init__(self):
		self.cubes = []
		for i in range(10000 + 1):
			self.cubes.append(i ** 3)

	def run(self):
		x = rint()
		i = 1
		j = len(self.cubes) - 1
		while i <= j:
			s = self.cubes[i] + self.cubes[j]
			if s == x:
				return 'YES'
			elif s > x:
				j -= 1
			else:
				i += 1
		return 'NO'
t = int(input())
s = Solution()
for i in range(t):
	print(s.run())


T = int(input())
c = 0
for i in range(T):
	a = int(input())
	x = int(a ** (1 / 3))
	y = 1
	con = True
	while True:
		z = x ** 3 + y ** 3
		if z == a:
			print('YES')
			con = False
			break
		elif z > a:
			x -= 1
		y += 1
		if y > x:
			break
	if con:
		print('NO')


t = int(input())
st = set()
while t > 0:
	t -= 1
	n = int(input())
	if n == 1:
		print('NO')
		continue
	else:
		okay = True
		for i in range(1, n):
			num = i * i * i
			if num * 2 == n:
				st.add(num)
				break
			if num > n:
				okay = False
				break
			elif n - num in st:
				break
			else:
				st.add(num)
		if okay == True:
			print('YES')
		else:
			print('NO')


import sys

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

def get_string():
	return sys.stdin.readline().strip()
FILE = False
if FILE:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
t = get_int()
array = {i ** 3 for i in range(1, 10001)}
for i in range(t):
	x = get_int()
	flag = False
	for a in array:
		if x - a in array:
			flag = True
			break
	if flag:
		sys.stdout.write('YES\n')
	else:
		sys.stdout.write('NO\n')


a = {}
for i in range(1, 10000):
	a[i * i * i] = '?'
t = int(input())
for i in range(t):
	x = int(input())
	ans = 0
	for k in a:
		if x - k in a:
			ans = 1
			break
	if ans == 1:
		print('YES')
	else:
		print('NO')


s = {x ** 3 for x in range(1, 10001)}
for _ in range(int(input())):
	x = int(input())
	flag = False
	for i in s:
		if x - i in s:
			print('YES')
			flag = True
			break
	if not flag:
		print('NO')


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

def sinp():
	return input()

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

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

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

def strl():
	return list(input())

def pr(x):
	print(x)
mod = int(1000000000.0 + 7)
for _ in range(inp()):
	x = inp()
	flag = False
	n = x ** (1 / 3)
	if n == int(n):
		n = int(n) - 1
	else:
		n = int(n)
	if n == 0:
		n += 1
	m = 1
	while m <= n:
		if pow(n, 3) + pow(m, 3) < x:
			m += 1
		elif pow(n, 3) + pow(m, 3) > x:
			n -= 1
		else:
			flag = True
			break
	if flag:
		pr('YES')
	else:
		pr('NO')


import math
out = []
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		out.append('NO')
		continue
	hi = math.floor(n ** (1 / 3))
	lo = math.floor((n / 2) ** (1 / 3))
	ans = 'NO'
	for i in range(hi, lo - 1, -1):
		temp = n - i ** 3
		check = math.floor(temp ** (1 / 3) + 1e-06)
		if check == 0:
			break
		if check ** 3 == temp:
			ans = 'YES'
			break
	out.append(ans)
print('\n'.join(out))


import math

def findit():
	n = int(input())
	p = math.pow(n, 1 / 3)
	q = math.floor(p)
	y = 1
	flag = True
	if n == 1:
		print('NO')
	elif n == 0:
		print('NO')
	else:
		while flag and y <= q:
			if y ** 3 + q ** 3 < n:
				y += 1
			elif y ** 3 + q ** 3 > n:
				q -= 1
			else:
				flag = False
				print('YES')
		if flag == True:
			print('NO')
test = int(input())
while test:
	findit()
	test -= 1


t = int(input())
while t > 0:
	n = int(input())
	cb = n ** (1.0 / 3)
	mp = dict()
	f = False
	for i in range(1, int(cb) + 1):
		mp[i * i * i] = 1
		if n - i * i * i in mp.keys():
			f = True
			break
	if f:
		print('YES')
	else:
		print('NO')
	t = t - 1


N = int(input())

def cube_root(n):
	n = abs(n)
	return n ** (1.0 / 3)

def is_perfect_cube(n):
	n = abs(n)
	return int(round(n ** (1.0 / 3))) ** 3 == n
for _ in range(N):
	it_is = False
	number = int(input())
	cube_rt = cube_root(number)
	for i in range(1, int(cube_rt) + 1):
		rest = number - i ** 3
		if is_perfect_cube(rest) and rest != 0:
			it_is = True
	if it_is:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
import math
import itertools
import bisect
import heapq

def main():
	pass
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')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def lis(arr):
	n = len(arr)
	lis = [1] * n
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
	maximum = 0
	for i in range(n):
		maximum = max(maximum, lis[i])
	return maximum

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def maxfac(n):
	root = int(n ** 0.5)
	for i in range(2, root + 1):
		if n % i == 0:
			return n // i
	return n

def p2(n):
	c = 0
	while n % 2 == 0:
		n //= 2
		c += 1
	return c

def seive(n):
	primes = [True] * (n + 1)
	primes[1] = primes[0] = False
	for i in range(2, n + 1):
		if primes[i]:
			for j in range(i + i, n + 1, i):
				primes[j] = False
	p = []
	for i in range(0, n + 1):
		if primes[i]:
			p.append(i)
	return p

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def denofactinverse(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return pow(fac, m - 2, m)

def numofact(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return fac
cubes = {1}
for i in range(1, 10000):
	cubes.add(i * i * i)
for xyz in range(0, int(input())):
	n = int(input())
	cbrt = int(pow(n, 1 / 3)) + 3
	f = False
	for i in range(1, cbrt):
		if n - i ** 3 in cubes:
			print('YES')
			f = True
			break
	if not f:
		print('NO')


import sys
s = set()
for a in range(1, 10000):
	s.add(a ** 3)
t = int(sys.stdin.readline().strip())
for _ in range(t):
	x = int(sys.stdin.readline().strip())
	for i in s:
		if x - i in s:
			print('YES')
			break
	else:
		print('NO')


import sys, random, math

def cube(n, s):
	x = int(math.pow(n, 1 / 3))
	for i in s:
		if n - i in s:
			return 'YES'
	return 'NO'
s = set([i * i * i for i in range(1, 10001)])
t = int(input())
for _ in range(t):
	n = int(input())
	print(cube(n, s))


l = set((i ** 3 for i in range(1, 10000)))
a = 0
for _ in range(int(input())):
	n = int(input())
	for i in l:
		if n - i in l:
			a = 1
			break
	if a == 1:
		print('YES')
	else:
		print('NO')
	a = 0


c = {i ** 3 for i in range(1, 10000)}
for _ in range(int(input())):
	a = int(input())
	for i in c:
		if a - i in c:
			print('YES')
			break
	else:
		print('NO')


ls_cube = [i * i * i for i in range(1, 10001)]

def binarysearch(ls, n, key):
	start = 0
	end = n - 1
	while start <= end:
		mid = (start + end) // 2
		if ls[mid] == key:
			return True
		elif ls[mid] > key:
			end = mid - 1
		else:
			start = mid + 1
	return False
for _ in range(int(input())):
	n = int(input())
	for i in ls_cube:
		if binarysearch(ls_cube, 10000, n - i):
			print('YES')
			break
	else:
		print('NO')


for cases in range(int(input())):
	x = int(input())
	if x == 2:
		print('yes')
		continue
	i = 1
	myset = set()
	found = False
	while i * i * i < x:
		cube = i * i * i
		if x - cube in myset or x == 2 * cube:
			print('yes')
			found = True
			break
		else:
			myset.add(cube)
		i += 1
	if not found:
		print('no')


__version__ = '3.1'
__date__ = '2021-03-13'
import sys

def solve(x, cubes) -> bool:
	for c in cubes:
		if x - c in cubes:
			return True
	return False

def main(argv=None):
	cubes = {pow(i, 3) for i in range(1, 10001)}
	t = int(input())
	for _ in range(t):
		x = int(input())
		ans = solve(x, cubes)
		print('YES' if ans == True else 'NO')
	return 0
STATUS = main()
sys.exit(STATUS)


import math
t = int(input())
for _ in range(t):
	flag = 0
	n = int(input())
	if n == 1:
		flag = 0
	elif n == 2:
		print('YES')
		flag = 1
	else:
		for j in range(1, round(math.pow(n, 1 / 3))):
			a = j * j * j
			b = n - a
			c = round(b ** (1 / 3))
			if c ** 3 == b:
				flag = 1
				print('YES')
				break
	if flag == 0:
		print('NO')


import sys
input = sys.stdin.readline
import bisect
C = [i ** 3 for i in range(1, 10 ** 4 + 1)]
t = int(input())
for tests in range(t):
	x = int(input())
	flag = 0
	for c in C:
		if c > x:
			break
		k = bisect.bisect(C, x - c)
		if C[k - 1] == x - c:
			print('YES')
			flag = 1
			break
	if flag == 0:
		print('NO')


for _ in range(int(input())):
	x = int(input())
	a = int(x ** (1 / 3))
	found = False
	A = a * a * a
	b = int((x - A) ** (1 / 3))
	if b == 0:
		print('NO')
		continue
	for i in range(b, a + 1):
		if A + i * i * i < x:
			continue
		R = x - i * i * i
		if R != round(R ** (1 / 3)) ** 3:
			continue
		for j in range(i, a + 1):
			if j * j * j == R:
				found = True
				break
		if found:
			break
	if found:
		print('YES')
	else:
		print('NO')


import sys, math
from collections import deque, defaultdict
import operator as op
from functools import reduce
from itertools import permutations
I = sys.stdin.readline

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

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

def mi():
	return map(int, I().strip().split())

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	elif n <= 2:
		return True
	else:
		for i in range(2, int(n ** 0.5) + 1):
			if n % i == 0:
				return False
		return True

def perfectcube(x):
	tmp = int(x ** (1 / 3))
	while tmp * tmp * tmp < x:
		tmp += 1
	while tmp * tmp * tmp > x:
		tmp -= 1
	if tmp * tmp * tmp == x:
		return True
	return False

def main():
	ans = ''
	for _ in range(ii()):
		n = ii()
		tmp = 'NO'
		for i in range(1, 10001):
			x = n - i * i * i
			if x > 0:
				if perfectcube(x):
					tmp = 'YES'
					break
			else:
				break
		ans += tmp + '\n'
	print(ans)
main()


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from functools import cmp_to_key
from heapq import *
from math import gcd, factorial, floor, ceil, sqrt, log2
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def testcase(t):
	for pp in range(t):
		solve(pp)

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	y %= p - 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
inf = pow(10, 20)
mod = 10 ** 9 + 7
cubes = {}
for i in range(1, 10000 + 10):
	cubes[i * i * i] = 1

def solve(case):
	n = int(inp())
	for i in range(1, 10000):
		rem = n - i * i * i
		if rem <= 0:
			break
		if rem in cubes:
			print('YES')
			return
	print('NO')
testcase(int(inp()))


container = set()
query = int(input())
for i in range(1, 10001):
	container.add(i * i * i)
for q in range(query):
	num = int(input())
	possible = False
	for temp in container:
		if num - temp in container:
			possible = True
	print('YES' if possible else 'NO')


a = set([i ** 3 for i in range(1, 10000)])
for _ in range(int(input())):
	x = int(input())
	ans = 'NO'
	for i in a:
		if x - i in a:
			ans = 'YES'
	print(ans)


l = set()
i = 1
while i * i * i <= pow(10, 12):
	l.add(i * i * i)
	i += 1
for _ in range(int(input())):
	x = int(input())
	for i in l:
		if x - i in l:
			print('YES')
			break
	else:
		print('NO')


t = int(input())
f = []
for _ in range(t):
	n = int(input())
	cubes = {}
	for i in range(1, int(n ** (1.0 / 3.0)) + 8):
		cubes[i ** 3] = 1
	for i in range(1, len(cubes)):
		a = i ** 3
		b = n - a
		g = cubes.get(b)
		if g == None:
			ans = 'No'
		else:
			ans = 'Yes'
			break
	f.append(ans)
for k in f:
	print(k)


from math import ceil
from sys import stdin
input = stdin.readline
l = {i ** 3 for i in range(1, 10001)}
for _ in range(int(input())):
	n = int(input())
	f = 0
	for i in l:
		if n - i in l:
			print('YES')
			f = 1
			break
	if f == 0:
		print('NO')


cubSet = set()
for i in range(1, 10001):
	cubSet.add(i ** 3)
for k in range(int(input())):
	x = int(input())
	res = False
	for c1 in cubSet:
		if x - c1 in cubSet:
			res = True
			print('YES')
			break
	if not res:
		print('NO')


AllCubes = {e ** 3 for e in range(1, int(1000000000000.0 ** (1 / 3)) + 1)}
for _ in range(int(input())):
	x = int(input())
	a = 1
	for cube in AllCubes:
		if x - cube in AllCubes:
			a = 0
			break
	print('YNEOS'[a::2])


from math import floor

def solve():
	global cubes
	n = int(input())
	for i in range(1, floor(n ** (1 / 3)) + 1):
		if n - i ** 3 in cubes:
			return True
	return False
MAX_N = 10 ** 12 + 1
cubes = set()
i = 1
while i ** 3 < MAX_N:
	cubes.add(i ** 3)
	i += 1
for t in range(int(input())):
	if solve():
		print('YES')
	else:
		print('NO')


import sys
YES = 'YES'
NO = 'NO'
MOD = 1000000007

def input_int():
	return int(input())

def input_list():
	return input().split(' ')

def input_list_int():
	return list(map(int, input_list()))
x = 10001
res = set()
for i in range(1, x):
	res.add(i * i * i)

def solve():
	n = input_int()
	for i in res:
		k = n - i
		if k in res:
			print(YES)
			return
	print(NO)
query_count = input_int()
while query_count:
	query_count -= 1
	solve()


list_ = set([a ** 3 for a in range(1, 10 ** 4)])
t = int(input())
for i in range(t):
	n = int(input())
	c = 0
	for b in list_:
		if n - b in list_:
			c += 1
			break
	if c > 0:
		print('YES')
	else:
		print('NO')


c = [i ** 3 for i in range(1, 10 ** 4 + 9)]
z = set(c)
t = int(input())
for i in range(t):
	x = int(input())
	for j in c:
		if x - j in z:
			print('YES')
			break
	else:
		print('NO')


def ct(a):
	x = int(input())
	for n in a:
		if x - n in a:
			return 'YES'
	return 'NO'
a = set((i ** 3 for i in range(1, 10001)))
t = int(input())
for i in range(t):
	print(ct(a))


from collections import *
import math
test = int(input())
while test > 0:
	test -= 1
	n = int(input())
	m = int(math.pow(n, 1 / 3))
	arr = defaultdict(lambda : 0)
	for t in range(1, m + 1):
		arr[t ** 3] += 1
	flag = 0
	arr2 = list(arr.keys())
	for k in range(m):
		val = n - arr2[k]
		if arr[val] != 0:
			flag = 1
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


for u in range(int(input())):
	n = int(input())
	d = {}
	for i in range(1, 10003):
		d[i ** 3] = d.get(i ** 3, 0) + 1
	f = False
	for i in range(1, 10003):
		x = n - i ** 3
		if x in d:
			f = True
			break
	if f:
		print('YES')
	else:
		print('NO')


p = {i ** 3 for i in range(1, 10001)}
for _ in range(int(input())):
	x = int(input())
	for y in p:
		if x - y in p:
			print('YES')
			break
	else:
		print('NO')


cubSet = set()
for i in range(1, 10001):
	cubSet.add(i ** 3)
for _ in range(int(input())):
	x = int(input())
	for num in cubSet:
		if x - num in cubSet:
			print('YES')
			break
	else:
		print('NO')


def calculateCubes(N: int):
	for i in range(1, N + 1):
		cubes.add(i ** 3)

def cf_702C(n: int):
	for x in cubes:
		if n - x in cubes:
			return True
cubes = set()
calculateCubes(10 ** 4)
for _ in range(int(input())):
	print('YES' if cf_702C(int(input())) else 'NO')


p = set((x ** 3 for x in range(1, 10 ** 4)))
for _ in range(int(input())):
	n = int(input())
	rep = 'NO'
	for k in p:
		if n - k in p:
			rep = 'YES'
			break
	print(rep)


s = {i ** 3 for i in range(1, 10001)}
kt = 0
for i in range(int(input())):
	x = int(input())
	kt = 0
	for a in s:
		if x - a in s:
			print('YES')
			kt = 1
			break
	if kt == 0:
		print('NO')


def sum_of_cubes(num):
	d = {}
	for ele in cubes_list:
		d[ele] = 1
		if num - ele in d and d[num - ele]:
			return 'YES'
	return 'NO'
cubes_list = [i * i * i for i in range(1, 10009)]
for i in range(int(input())):
	n = int(input())
	print(sum_of_cubes(n))


t = int(input())
s = [pow(i, 3) for i in range(1, 10005)]
ss = set(s)
for _ in range(t):
	x = int(input())
	ans = 'NO'
	for i in s:
		if x - i in ss:
			ans = 'YES'
			break
	print(ans)


def s(x):
	di = dict()
	for i in range(1, 10000):
		di[i * i * i] = 1
	for i in range(1, 10000):
		y = x - i * i * i
		t = di.get(y, 0)
		if t:
			return True
	return False
	return False

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


from collections import OrderedDict
tc = int(input())
n = []
for _ in range(tc):
	num = int(input())
	n.append(num)
hashMap = OrderedDict()
i = 1
while i ** 3 <= max(n):
	hashMap[i ** 3] = 0
	i += 1

def check(num):
	for val in hashMap:
		if num - val in hashMap:
			print('YES')
			return
	print('NO')
	return
for num in n:
	check(num)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	x = int(input())
	i = 1
	ans = 'NO'
	while i ** 3 < x:
		rest = x - i ** 3
		if int(round(rest ** (1 / 3))) ** 3 == rest:
			ans = 'YES'
			break
		i += 1
	print(ans)


arr = set()
n = 1
while True:
	temp = n ** 3
	if temp > 10 ** 12:
		break
	arr.add(temp)
	n += 1
for _ in range(int(input())):
	x = int(input())
	flag = 1
	for i in arr:
		if x - i in arr:
			flag = 0
			print('YES')
			break
	if flag:
		print('NO')


import math as mt
import sys
import string
from collections import Counter, defaultdict

def I():
	return int(input())

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

def ARR():
	return list(map(int, input().split()))
cubes = defaultdict(bool)

def findCubes():
	mx = int(1000000000000.0 + 5)
	(i, i3) = (1, 1)
	while i3 < mx:
		cubes[i3] = True
		i += 1
		i3 = i ** 3

def main():
	x = I()
	ok = False
	for cube in cubes.keys():
		a = cube
		b = x - cube
		if b < 1:
			break
		elif cubes[b]:
			ok = True
			break
		else:
			del cubes[b]
	if ok:
		print('YES')
	else:
		print('NO')
findCubes()
tc = 1
tc = I()
for _ in range(tc):
	main()


s = set()
for i in range(1, 10001):
	s.add(i * i * i)
for y in range(int(input())):
	n = int(input())
	ans = 'NO'
	for i in s:
		if n - i in s:
			ans = 'YES'
	print(ans)


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline

def is_perfect_cube(number):
	number = abs(number)
	return round(number ** (1 / 3)) ** 3 == number
t = 1
t = int(input())
while t:
	t -= 1
	x = int(input())
	maxa = int(x ** (1 / 3))
	for a_ in range(1, maxa + 1):
		temp = x
		temp -= a_ ** 3
		if temp < 1:
			continue
		if is_perfect_cube(temp):
			print('YES')
			break
	else:
		print('NO')


CUBES = [x ** 3 for x in range(1, 10 ** 4 + 7)]
CUBES_SET = set(CUBES)

def solve(x):
	for cube in CUBES:
		if cube > x:
			break
		diff = x - cube
		if diff in CUBES_SET:
			return 'YES'
	return 'NO'

def main():
	for _ in range(int(input())):
		x = int(input())
		ans = solve(x)
		print(ans)
main()


import sys

def main():
	res = ''
	input = sys.stdin.readline
	print = sys.stdout.write
	t = int(input())
	cubes = set()
	for i in range(1, 10001):
		cubes.add(i * i * i)

	def solve(x):
		res = 'NO'
		for a in cubes:
			if x - a in cubes:
				res = 'YES'
				break
		return res
	for _ in range(t):
		x = int(input())
		res += str(solve(x)) + '\n'
	print(res)
main()


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
from collections import deque
BUFSIZE = 8192
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')

def main():
	t = int(input())
	s = set()
	for i in range(1, 10001):
		s.add(i ** 3)
	for i in range(t):
		x = int(input())
		f = False
		for y in s:
			if x - y in s:
				f = True
				break
		if f:
			print('YES')
		else:
			print('NO')
main()


s = {i ** 3 for i in range(1, 10000)}
for i in range(int(input())):
	n = int(input())
	for i in s:
		if n - i in s:
			print('YES')
			break
	else:
		print('NO')


from math import ceil, floor
l = []
for i in range(1, 10000):
	l.append(i * i * i)
for _ in range(int(input())):
	n = int(input())
	i = 0
	j = len(l) - 1
	flag = 0
	while j >= i:
		if l[j] + l[i] == n:
			flag = 1
			break
		if l[j] + l[i] > n:
			j -= 1
		else:
			i += 1
	if flag:
		print('YES')
	else:
		print('NO')


import sys, collections, math, itertools, random, bisect
INF = sys.maxsize

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

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

def input():
	return sys.stdin.readline().strip()
mod = 1000000007
arr = [0] * 100001
mp = collections.defaultdict(int)
for i in range(1, 100001):
	arr[i] = i * i * i
	mp[arr[i]] = i
for _ in range(int(input())):
	n = int(input())
	flag = 0
	for i in range(1, 100001):
		if arr[i] <= n:
			comp = n - arr[i]
			if mp[comp]:
				flag = 1
				break
		else:
			break
	print('YES' if flag else 'NO')


import random
import time
tic = time.perf_counter()
n_e = input()
elements = []
for i in range(int(n_e)):
	elements.append(int(input()))
cubos = []
for idx in range(1, 10000 + 1):
	cubos.append(pow(idx, 3))

def f_suma_cubos(x):
	limite = int(x ** (1 / 3))
	if cubos[limite] > x:
		limite -= 1
	b = x - cubos[0]
	b_i = int(b ** (1 / 3))
	b_i -= 1
	if cubos[b_i] + cubos[0] == x:
		return 'YES'
	if cubos[b_i] + cubos[0] > x:
		b_i -= 1
	cont = 0
	i = 1
	while i < limite + 1:
		b = x - cubos[i]
		diferencia = x - (cubos[i] + cubos[b_i])
		if diferencia < 0:
			b_i = int(b ** (1 / 3))
			b_i -= 1
			if cubos[b_i] + cubos[i] > x:
				b_i -= 1
			cont += 1
		if b == cubos[b_i]:
			return 'YES'
		i += 1
	return 'NO'
already_processed = {}
for e in elements:
	if e in already_processed.keys():
		print(already_processed[e])
		continue
	else:
		result = f_suma_cubos(e)
		already_processed[e] = result
		print(result)
toc = time.perf_counter()


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
import time
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		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 = self.os.read(self._fd, max(self.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 = self.os.read(self._fd, max(self.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:
			self.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')
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]

def isInt(s):
	return '0' <= s[0] <= '9'
MOD = 10 ** 9 + 7
cubes = set([i ** 3 for i in range(1, 10 ** 4 + 1)])

def solve():
	X = getInt()
	for i in range(1, 10 ** 4 + 1):
		if X - i ** 3 in cubes:
			return 'YES'
	return 'NO'
for _ in range(getInt()):
	print(solve())


S = set()
for i in range(1, 10000):
	S.add(i ** 3)
for _ in range(int(input())):
	N = int(input())
	flag = False
	for i in S:
		if N - i in S:
			flag = True
			break
	if flag:
		print('YES')
	else:
		print('NO')


a = {i ** 3 for i in range(1, 10000)}
for s in [*open(0)][1:]:
	print('YNEOS'[not {int(s) - y for y in a} & a::2])


def cube(n):
	i = 1
	while i ** 3 < n:
		if round((n - i ** 3) ** (1 / 3)) ** 3 == n - i ** 3:
			return 'Yes'
		i += 1
	return 'No'
t = int(input())
for _ in range(t):
	n = int(input())
	print(cube(n))


def cube(x):
	x = abs(x)
	return int(round(x ** (1.0 / 3))) ** 3 == x
for i in range(int(input())):
	n = int(input())
	b = 1
	for i in range(1, int(n ** (1 / 3)) + 3):
		x = n - pow(i, 3)
		if x > 0 and cube(x):
			print('YES')
			b = 0
			break
	if b:
		print('NO')


n = int(input())
r = []
for i in range(n):
	t = False
	inter = int(input())
	for j in range(1, inter):
		m = inter - j ** 3
		if m <= 0:
			r.append('NO')
			t = True
			break
		if (int(m ** (1 / 3)) + 1) ** 3 == m or int(m ** (1 / 3)) ** 3 == m:
			r.append('YES')
			t = True
			break
	if t == False:
		r.append('NO')
for item in r:
	print(item)