#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 /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, m, i, u, doudou1, doudou2;
  int ar;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &m);
    doudou1 = 0;
    doudou2 = 0;
    for (u = 1; u <= m; u++) {
      scanf("%d", &ar);
      if (ar == 0)
        doudou1 = 1;
      if (ar == 1)
        doudou2 = 1;
    }
    if (doudou1 == 1 && doudou2 == 1)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     120c <main+0xec>
lea    0xea7(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11c8 <main+0xa8>
lea    0xe76(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x20(%rbp)
jne    11a4 <main+0x84>
movl   $0x1,-0x18(%rbp)
cmpl   $0x1,-0x20(%rbp)
jne    11b5 <main+0x95>
movl   $0x1,-0x1c(%rbp)
jmp    11ba <main+0x9a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1177 <main+0x57>
cmpl   $0x1,-0x18(%rbp)
jne    11ed <main+0xcd>
cmpl   $0x1,-0x1c(%rbp)
jne    11ed <main+0xcd>
lea    0xe20(%rip),%rdi
call   1030 <printf@plt>
jmp    11f9 <main+0xd9>
lea    0xe14(%rip),%rdi
call   1030 <printf@plt>
jmp    11fe <main+0xde>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1146 <main+0x26>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecb(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    11f4 <main+0xd4>
lea    0xeaf(%rip),%rbx
lea    0xc(%rsp),%rbp
mov    $0x1,%r14d
mov    $0x1,%r15d
jmp    118a <main+0x6a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xe8c(%rip),%rdi
call   1030 <puts@plt>
lea    0x1(%r14),%eax
cmp    0x8(%rsp),%r14d
mov    %eax,%r14d
jge    11f4 <main+0xd4>
mov    %rbx,%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    1170 <main+0x50>
mov    %r14,0x10(%rsp)
xor    %r14d,%r14d
xor    %r12d,%r12d
xor    %r13d,%r13d
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
cmove  %r15d,%r13d
cmp    $0x1,%eax
cmove  %eax,%r12d
add    $0x1,%r14d
cmp    0x4(%rsp),%r14d
jl     11b0 <main+0x90>
cmp    $0x1,%r13d
mov    0x10(%rsp),%r14
jne    1170 <main+0x50>
lea    0xe1d(%rip),%rdi
cmp    $0x1,%r12d
je     1177 <main+0x57>
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x18,%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"YES\0A\00"
@.str.2 = [4 x i8] c"NO\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 1, i32* %4
br label %10
10: ; preds = %44, %0
%11 = load i32, i32* %4
%12 = load i32, i32* %2
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %47
14: ; preds = %10
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %6
store i32 0, i32* %7
store i32 1, i32* %5
br label %16
16: ; preds = %30, %14
%17 = load i32, i32* %5
%18 = load i32, i32* %3
%19 = icmp sle i32 %17, %18
br i1 %19, label %20, label %33
20: ; preds = %16
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %8)
%22 = load i32, i32* %8
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 1, i32* %6
br label %25
25: ; preds = %24, %20
%26 = load i32, i32* %8
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %29
28: ; preds = %25
store i32 1, i32* %7
br label %29
29: ; preds = %28, %25
br label %30
30: ; preds = %29
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %16
33: ; preds = %16
%34 = load i32, i32* %6
%35 = icmp eq i32 %34, 1
br i1 %35, label %36, label %41
36: ; preds = %33
%37 = load i32, i32* %7
%38 = icmp eq i32 %37, 1
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %43
41: ; preds = %36, %33
%42 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %43
43: ; preds = %41, %39
br label %44
44: ; preds = %43
%45 = load i32, i32* %4
%46 = add nsw i32 %45, 1
store i32 %46, i32* %4
br label %10
47: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [3 x i8] c"NO\00"
@str.3 = [4 x i8] c"YES\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 1
br i1 %9, label %39, label %10
10: ; preds = %0, %33
%11 = phi i32 [ %36, %33 ], [ 1, %0 ]
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 1
br i1 %14, label %32, label %15
15: ; preds = %10, %15
%16 = phi i32 [ %24, %15 ], [ 0, %10 ]
%17 = phi i32 [ %22, %15 ], [ 0, %10 ]
%18 = phi i32 [ %25, %15 ], [ 1, %10 ]
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 0
%22 = select i1 %21, i32 1, i32 %17
%23 = icmp eq i32 %20, 1
%24 = select i1 %23, i32 1, i32 %16
%25 = add nuw nsw i32 %18, 1
%26 = load i32, i32* %2
%27 = icmp slt i32 %18, %26
br i1 %27, label %15, label %28
28: ; preds = %15
%29 = icmp eq i32 %22, 1
%30 = icmp eq i32 %24, 1
%31 = select i1 %29, i1 %30, i1 false
br i1 %31, label %33, label %32
32: ; preds = %10, %28
br label %33
33: ; preds = %28, %32
%34 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0), %32 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.3, i64 0, i64 0), %28 ]
%35 = call i32 @puts(i8* dereferenceable(1) %34)
%36 = add nuw nsw i32 %11, 1
%37 = load i32, i32* %1
%38 = icmp slt i32 %11, %37
br i1 %38, label %10, label %39
39: ; preds = %33, %0
ret i32 0
}