#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int Check(long long, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
double sqrt(long long);
int main() {
  int t;
  scanf("%d", &t);
  long long int a, arr[t], j, k, r;
  double q;
  int i, v = 0;
  for (i = 0; i < t; i++)
    scanf("%lld", &arr[i]);
  for (i = 0; i < t; i++) {
    v = 0;
    a = arr[i];
    q = sqrt(a);
    if (q - (int)q == 0) {
      printf("Yes\n");
      continue;
    }
    for (j = (int)q; j >= 0; j--) {
      r = a - (j * j);
      v = Check(r, (int)q);
      if (v) {
        printf("Yes\n");
        break;
      } else
        continue;
    }
    if (v == 0)
      printf("No\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11cd <main+0x8d>
mov    -0x50(%rbp),%rsi
movslq -0x44(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1196 <main+0x56>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12d0 <main+0x190>
mov    -0x50(%rbp),%rax
movl   $0x0,-0x48(%rbp)
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <sqrt@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
cvttsd2si -0x40(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    123b <main+0xfb>
jp     123b <main+0xfb>
lea    0xdd7(%rip),%rdi
call   1030 <printf@plt>
jmp    12c2 <main+0x182>
cvttsd2si -0x40(%rbp),%eax
cltq
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jl     12a7 <main+0x167>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
imul   -0x28(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
cvttsd2si -0x40(%rbp),%esi
call   1060 <Check@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
je     1291 <main+0x151>
lea    0xd81(%rip),%rdi
call   1030 <printf@plt>
jmp    12a7 <main+0x167>
jmp    1296 <main+0x156>
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
jmp    1246 <main+0x106>
cmpl   $0x0,-0x48(%rbp)
jne    12bd <main+0x17d>
lea    0xd55(%rip),%rdi
call   1030 <printf@plt>
jmp    12c2 <main+0x182>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11d4 <main+0x94>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeb0(%rip),%rdi
lea    -0x2c(%rbp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %rsp,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%r12
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
cmpl   $0x0,-0x2c(%rbp)
jle    1267 <main+0x127>
lea    0xe7b(%rip),%r14
mov    %r12,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
add    $0x8,%r15
cmp    %rax,%rbx
jl     11a0 <main+0x60>
test   %eax,%eax
jle    1267 <main+0x127>
xor    %r13d,%r13d
lea    0xe43(%rip),%r15
jmp    11f2 <main+0xb2>
lea    0xe3a(%rip),%r15
mov    %r15,%rdi
nopl   0x0(%rax)
call   1030 <puts@plt>
add    $0x1,%r13
movslq -0x2c(%rbp),%rax
cmp    %rax,%r13
jge    1267 <main+0x127>
mov    (%r12,%r13,8),%r14
mov    %r14,%rdi
call   1050 <sqrt@plt>
cvttpd2dq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm1
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
ucomisd 0xdea(%rip),%xmm2
mov    %r15,%rdi
jne    121d <main+0xdd>
jnp    11e0 <main+0xa0>
cvttsd2si %xmm0,%ebx
lea    0xde8(%rip),%rdi
test   %ebx,%ebx
js     11e0 <main+0xa0>
mov    %ebx,%r15d
nop
mov    %r15,%rax
imul   %r15,%rax
mov    %r14,%rdi
sub    %rax,%rdi
mov    %ebx,%esi
call   1060 <Check@plt>
test   %eax,%eax
jne    11d2 <main+0x92>
lea    -0x1(%r15),%rax
test   %r15,%r15
mov    %rax,%r15
jg     1230 <main+0xf0>
lea    0xdb5(%rip),%rdi
lea    0xdb1(%rip),%r15
jmp    11e0 <main+0xa0>
mov    -0x38(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%lld\00"
@.str.2 = [5 x i8] c"Yes\0A\00"
@.str.3 = [4 x i8] c"No\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %4
%16 = alloca i64, i64 %14
store i64 %14, i64* %5
store i32 0, i32* %11
store i32 0, i32* %10
br label %17
17: ; preds = %26, %0
%18 = load i32, i32* %10
%19 = load i32, i32* %2
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %29
21: ; preds = %17
%22 = load i32, i32* %10
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i64, i64* %16, i64 %23
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %24)
br label %26
26: ; preds = %21
%27 = load i32, i32* %10
%28 = add nsw i32 %27, 1
store i32 %28, i32* %10
br label %17
29: ; preds = %17
store i32 0, i32* %10
br label %30
30: ; preds = %80, %29
%31 = load i32, i32* %10
%32 = load i32, i32* %2
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %83
34: ; preds = %30
store i32 0, i32* %11
%35 = load i32, i32* %10
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i64, i64* %16, i64 %36
%38 = load i64, i64* %37
store i64 %38, i64* %3
%39 = load i64, i64* %3
%40 = call double @sqrt(i64 %39)
store double %40, double* %9
%41 = load double, double* %9
%42 = load double, double* %9
%43 = fptosi double %42 to i32
%44 = sitofp i32 %43 to double
%45 = fsub double %41, %44
%46 = fcmp oeq double %45, 0.000000e+00
br i1 %46, label %47, label %49
47: ; preds = %34
%48 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %80
49: ; preds = %34
%50 = load double, double* %9
%51 = fptosi double %50 to i32
%52 = sext i32 %51 to i64
store i64 %52, i64* %6
br label %53
53: ; preds = %71, %49
%54 = load i64, i64* %6
%55 = icmp sge i64 %54, 0
br i1 %55, label %56, label %74
56: ; preds = %53
%57 = load i64, i64* %3
%58 = load i64, i64* %6
%59 = load i64, i64* %6
%60 = mul nsw i64 %58, %59
%61 = sub nsw i64 %57, %60
store i64 %61, i64* %8
%62 = load i64, i64* %8
%63 = load double, double* %9
%64 = fptosi double %63 to i32
%65 = call i32 @Check(i64 %62, i32 %64)
store i32 %65, i32* %11
%66 = load i32, i32* %11
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %70
68: ; preds = %56
%69 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %74
70: ; preds = %56
br label %71
71: ; preds = %70
%72 = load i64, i64* %6
%73 = add nsw i64 %72, -1
store i64 %73, i64* %6
br label %53
74: ; preds = %68, %53
%75 = load i32, i32* %11
%76 = icmp eq i32 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %74
%78 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %79
79: ; preds = %77, %74
br label %80
80: ; preds = %79, %47
%81 = load i32, i32* %10
%82 = add nsw i32 %81, 1
store i32 %82, i32* %10
br label %30
83: ; preds = %30
store i32 0, i32* %1
%84 = load i8*, i8** %4
%85 = load i32, i32* %1
ret i32 %85
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%lld\00"
@str = [3 x i8] c"No\00"
@str.5 = [4 x i8] c"Yes\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = zext i32 %4 to i64
%6 = call i8* @llvm.stacksave()
%7 = alloca i64, i64 %5
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 0
br i1 %9, label %12, label %49
10: ; preds = %12
%11 = icmp sgt i32 %17, 0
br i1 %11, label %20, label %49
12: ; preds = %0, %12
%13 = phi i64 [ %16, %12 ], [ 0, %0 ]
%14 = getelementptr inbounds i64, i64* %7, i64 %13
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %14)
%16 = add nuw nsw i64 %13, 1
%17 = load i32, i32* %1
%18 = sext i32 %17 to i64
%19 = icmp slt i64 %16, %18
br i1 %19, label %12, label %10
20: ; preds = %10, %42
%21 = phi i64 [ %45, %42 ], [ 0, %10 ]
%22 = getelementptr inbounds i64, i64* %7, i64 %21
%23 = load i64, i64* %22
%24 = call double @sqrt(i64 %23)
%25 = fptosi double %24 to i32
%26 = sitofp i32 %25 to double
%27 = fsub double %24, %26
%28 = fcmp oeq double %27, 0.000000e+00
br i1 %28, label %42, label %29
29: ; preds = %20
%30 = icmp sgt i32 %25, -1
br i1 %30, label %31, label %42
31: ; preds = %29
%32 = zext i32 %25 to i64
br label %36
33: ; preds = %36
%34 = add nsw i64 %37, -1
%35 = icmp sgt i64 %37, 0
br i1 %35, label %36, label %42
36: ; preds = %31, %33
%37 = phi i64 [ %34, %33 ], [ %32, %31 ]
%38 = mul nsw i64 %37, %37
%39 = sub nsw i64 %23, %38
%40 = call i32 @Check(i64 %39, i32 %25)
%41 = icmp eq i32 %40, 0
br i1 %41, label %33, label %42
42: ; preds = %33, %36, %29, %20
%43 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.5, i64 0, i64 0), %20 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0), %29 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.5, i64 0, i64 0), %36 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0), %33 ]
%44 = call i32 @puts(i8* dereferenceable(1) %43)
%45 = add nuw nsw i64 %21, 1
%46 = load i32, i32* %1
%47 = sext i32 %46 to i64
%48 = icmp slt i64 %45, %47
br i1 %48, label %20, label %49
49: ; preds = %42, %0, %10
ret i32 0
}