#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 t, n, a;
  scanf("%d", &t);
  while (t--) {
    int i, fail = 0, pass = 0;
    float sum = 0;
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
      scanf("%d", &a);
      if (a == 2) {
        fail = 1;
      }
      if (a == 5)
        pass = 1;
      sum = sum + a;
    }
    sum = sum / n;
    if (sum >= 4 && pass == 1 && fail == 0)
      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    0xece(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     123e <main+0x11e>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
lea    0xe94(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11df <main+0xbf>
lea    0xe71(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x2,-0x10(%rbp)
jne    11ad <main+0x8d>
movl   $0x1,-0x18(%rbp)
cmpl   $0x5,-0x10(%rbp)
jne    11be <main+0x9e>
movl   $0x1,-0x1c(%rbp)
movss  -0x20(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1180 <main+0x60>
movss  -0x20(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
movss  0xe01(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     122d <main+0x10d>
cmpl   $0x1,-0x1c(%rbp)
jne    122d <main+0x10d>
cmpl   $0x0,-0x18(%rbp)
jne    122d <main+0x10d>
lea    0xde4(%rip),%rdi
call   1030 <printf@plt>
jmp    1239 <main+0x119>
lea    0xdd8(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <main+0x1f>
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    0xecf(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
subl   $0x1,0xc(%rsp)
jae    1157 <main+0x37>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xea6(%rip),%rbx
lea    0x14(%rsp),%r15
mov    $0x1,%ebp
jmp    11b7 <main+0x97>
nopw   0x0(%rax,%rax,1)
xorps  %xmm1,%xmm1
xor    %r12d,%r12d
xor    %r14d,%r14d
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  %xmm0,%xmm1
xor    $0x1,%r14d
or     %r12d,%r14d
lea    0xe75(%rip),%rcx
mov    %rcx,%rdi
lea    0xe6e(%rip),%rax
cmove  %rax,%rdi
ucomiss 0xe59(%rip),%xmm1
cmovb  %rcx,%rdi
call   1030 <puts@plt>
subl   $0x1,0xc(%rsp)
jb     1146 <main+0x26>
mov    %rbx,%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
jle    1170 <main+0x50>
xor    %r14d,%r14d
xorps  %xmm1,%xmm1
xor    %r12d,%r12d
xor    %r13d,%r13d
nopl   0x0(%rax,%rax,1)
movss  %xmm1,0x10(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movss  0x10(%rsp),%xmm1
mov    0x14(%rsp),%eax
cmp    $0x2,%eax
cmove  %ebp,%r12d
cmp    $0x5,%eax
cmove  %ebp,%r14d
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
addss  %xmm0,%xmm1
add    $0x1,%r13d
mov    0x8(%rsp),%eax
cmp    %eax,%r13d
jl     11e0 <main+0xc0>
jmp    1179 <main+0x59>

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 float
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)
br label %10
10: ; preds = %54, %0
%11 = load i32, i32* %2
%12 = add nsw i32 %11, -1
store i32 %12, i32* %2
%13 = icmp ne i32 %11, 0
br i1 %13, label %14, label %55
14: ; preds = %10
store i32 0, i32* %6
store i32 0, i32* %7
store float 0.000000e+00, float* %8
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %5
br label %16
16: ; preds = %34, %14
%17 = load i32, i32* %5
%18 = load i32, i32* %3
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %37
20: ; preds = %16
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 2
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* %4
%27 = icmp eq i32 %26, 5
br i1 %27, label %28, label %29
28: ; preds = %25
store i32 1, i32* %7
br label %29
29: ; preds = %28, %25
%30 = load float, float* %8
%31 = load i32, i32* %4
%32 = sitofp i32 %31 to float
%33 = fadd float %30, %32
store float %33, float* %8
br label %34
34: ; preds = %29
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %16
37: ; preds = %16
%38 = load float, float* %8
%39 = load i32, i32* %3
%40 = sitofp i32 %39 to float
%41 = fdiv float %38, %40
store float %41, float* %8
%42 = load float, float* %8
%43 = fcmp oge float %42, 4.000000e+00
br i1 %43, label %44, label %52
44: ; preds = %37
%45 = load i32, i32* %7
%46 = icmp eq i32 %45, 1
br i1 %46, label %47, label %52
47: ; preds = %44
%48 = load i32, i32* %6
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %54
52: ; preds = %47, %44, %37
%53 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %54
54: ; preds = %52, %50
br label %10
55: ; 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 = add nsw i32 %8, -1
store i32 %9, i32* %1
%10 = icmp eq i32 %8, 0
br i1 %10, label %48, label %11
11: ; preds = %0, %31
%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 sgt i32 %13, 0
br i1 %14, label %15, label %31
15: ; preds = %11, %15
%16 = phi float [ %27, %15 ], [ 0.000000e+00, %11 ]
%17 = phi i32 [ %25, %15 ], [ 0, %11 ]
%18 = phi i32 [ %23, %15 ], [ 0, %11 ]
%19 = phi i32 [ %28, %15 ], [ 0, %11 ]
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, 2
%23 = select i1 %22, i32 1, i32 %18
%24 = icmp eq i32 %21, 5
%25 = select i1 %24, i32 1, i32 %17
%26 = sitofp i32 %21 to float
%27 = fadd float %16, %26
%28 = add nuw nsw i32 %19, 1
%29 = load i32, i32* %2
%30 = icmp slt i32 %28, %29
br i1 %30, label %15, label %31
31: ; preds = %15, %11
%32 = phi i32 [ 0, %11 ], [ %23, %15 ]
%33 = phi i32 [ 0, %11 ], [ %25, %15 ]
%34 = phi float [ 0.000000e+00, %11 ], [ %27, %15 ]
%35 = phi i32 [ %13, %11 ], [ %29, %15 ]
%36 = sitofp i32 %35 to float
%37 = fdiv float %34, %36
%38 = fcmp oge float %37, 4.000000e+00
%39 = icmp eq i32 %33, 1
%40 = select i1 %38, i1 %39, i1 false
%41 = icmp eq i32 %32, 0
%42 = select i1 %40, i1 %41, i1 false
%43 = select i1 %42, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0)
%44 = call i32 @puts(i8* dereferenceable(1) %43)
%45 = load i32, i32* %1
%46 = add nsw i32 %45, -1
store i32 %46, i32* %1
%47 = icmp eq i32 %45, 0
br i1 %47, label %48, label %11
48: ; preds = %31, %0
ret i32 0
}