#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 *, long long *);
int main() {
  long long int i, c, j, len, num, temp, t, res;
  scanf("%lld", &t);
  while (t--) {
    c = 0;
    scanf("%lld", &num);
    for (i = 0; i < num; i++) {
      scanf("%lld", &temp);
      c += temp;
      c = c % num;
    }
    if (c == 0)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x40(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x40(%rbp)
cmp    $0x0,%rax
je     11ee <main+0xce>
movq   $0x0,-0x18(%rbp)
lea    0xe99(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <scanf@plt>
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x30(%rbp),%rax
jge    11c1 <main+0xa1>
lea    0xe73(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x38(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cqto
idivq  -0x30(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1178 <main+0x58>
cmpq   $0x0,-0x18(%rbp)
jne    11dd <main+0xbd>
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
jmp    11e9 <main+0xc9>
lea    0xe26(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x50,%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
mov    %rsp,%rsi
call   1040 <scanf@plt>
subq   $0x1,(%rsp)
jae    1155 <main+0x35>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xea4(%rip),%r12
lea    0x8(%rsp),%r14
lea    0xea0(%rip),%r13
lea    0x10(%rsp),%r15
jmp    118a <main+0x6a>
nop
test   %rbx,%rbx
lea    0xe8b(%rip),%rdi
cmove  %r13,%rdi
call   1030 <puts@plt>
subq   $0x1,(%rsp)
jb     1144 <main+0x24>
mov    %r12,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
cmpq   $0x0,0x8(%rsp)
mov    %r13,%rdi
jle    117e <main+0x5e>
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    11c4 <main+0xa4>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rax
cqto
idiv   %rcx
mov    %rdx,%rbx
add    $0x1,%rbp
cmp    %rcx,%rbp
jge    1170 <main+0x50>
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
add    0x10(%rsp),%rbx
mov    0x8(%rsp),%rcx
mov    %rbx,%rax
or     %rcx,%rax
shr    $0x20,%rax
jne    11b0 <main+0x90>
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
mov    %edx,%ebx
jmp    11bb <main+0x9b>

LLVM IR (-O0):
@.str = [5 x i8] c"%lld\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 i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i32 0, i32* %1
%10 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %8)
br label %11
11: ; preds = %39, %0
%12 = load i64, i64* %8
%13 = add nsw i64 %12, -1
store i64 %13, i64* %8
%14 = icmp ne i64 %12, 0
br i1 %14, label %15, label %40
15: ; preds = %11
store i64 0, i64* %3
%16 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %6)
store i64 0, i64* %2
br label %17
17: ; preds = %29, %15
%18 = load i64, i64* %2
%19 = load i64, i64* %6
%20 = icmp slt i64 %18, %19
br i1 %20, label %21, label %32
21: ; preds = %17
%22 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %7)
%23 = load i64, i64* %7
%24 = load i64, i64* %3
%25 = add nsw i64 %24, %23
store i64 %25, i64* %3
%26 = load i64, i64* %3
%27 = load i64, i64* %6
%28 = srem i64 %26, %27
store i64 %28, i64* %3
br label %29
29: ; preds = %21
%30 = load i64, i64* %2
%31 = add nsw i64 %30, 1
store i64 %31, i64* %2
br label %17
32: ; preds = %17
%33 = load i64, i64* %3
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %39
37: ; preds = %32
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %39
39: ; preds = %37, %35
br label %11
40: ; preds = %11
ret i32 0
}

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