#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 *, unsigned long long *);
int main() {
  unsigned long long int n, i, t, j;
  scanf("%llu", &t);
  for (j = 0; j < t; j++) {
    scanf("%llu", &n);
    unsigned long long int sum = 0, ele[n];
    for (i = 0; i < n; i++) {
      scanf("%llu", &ele[i]);
      sum += ele[i] % n;
      if (sum % n == 0)
        sum = 0;
    }
    if (sum % n == 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    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1261 <main+0x141>
lea    0xea4(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movq   $0x0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1216 <main+0xf6>
mov    -0x48(%rbp),%rsi
mov    -0x18(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe3f(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x48(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
add    -0x30(%rbp),%rdx
mov    %rdx,-0x30(%rbp)
mov    -0x30(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
cmp    $0x0,%rdx
jne    1200 <main+0xe0>
movq   $0x0,-0x30(%rbp)
jmp    1205 <main+0xe5>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    119d <main+0x7d>
mov    -0x30(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
cmp    $0x0,%rdx
jne    123d <main+0x11d>
lea    0xdd2(%rip),%rdi
call   1030 <printf@plt>
jmp    1249 <main+0x129>
lea    0xdc6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1147 <main+0x27>
xor    %eax,%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    $0x28,%rsp
lea    0xec8(%rip),%rdi
lea    -0x48(%rbp),%rsi
call   1040 <scanf@plt>
cmpq   $0x0,-0x48(%rbp)
je     127b <main+0x15b>
xor    %ebx,%ebx
lea    0xeb3(%rip),%r15
jmp    11ab <main+0x8b>
nopw   0x0(%rax,%rax,1)
mov    %rcx,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     1270 <main+0x150>
mov    %rcx,%rax
xor    %edx,%edx
div    %rsi
mov    -0x40(%rbp),%rbx
lea    0xe85(%rip),%r15
mov    -0x38(%rbp),%r12
test   %rdx,%rdx
lea    0xe74(%rip),%rdi
cmove  %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rsp
add    $0x1,%rbx
cmp    -0x48(%rbp),%rbx
jae    127b <main+0x15b>
lea    0xe4e(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <scanf@plt>
mov    %rsp,%r12
mov    -0x30(%rbp),%rax
mov    %rsp,%r14
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
cmpq   $0x0,-0x30(%rbp)
mov    %r15,%rdi
je     1195 <main+0x75>
mov    %r12,-0x38(%rbp)
mov    %rbx,-0x40(%rbp)
xor    %r12d,%r12d
xor    %r13d,%r13d
xor    %r15d,%r15d
lea    0xe07(%rip),%rbx
jmp    1223 <main+0x103>
nopl   0x0(%rax,%rax,1)
mov    %rcx,%rax
xor    %edx,%edx
div    %rsi
test   %rdx,%rdx
cmove  %rdx,%rcx
add    $0x1,%r13
add    $0x8,%r12
mov    %rcx,%r15
cmp    %rsi,%r13
jae    1160 <main+0x40>
lea    (%r14,%r12,1),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    (%r14,%r13,8),%rax
mov    -0x30(%rbp),%rsi
mov    %rax,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     1250 <main+0x130>
xor    %edx,%edx
div    %rsi
mov    %rdx,%rcx
jmp    1256 <main+0x136>
nopl   (%rax)
xor    %edx,%edx
div    %esi
mov    %edx,%ecx
add    %r15,%rcx
mov    %rcx,%rax
or     %rsi,%rax
shr    $0x20,%rax
jne    1200 <main+0xe0>
mov    %ecx,%eax
xor    %edx,%edx
div    %esi
jmp    1208 <main+0xe8>
nopl   (%rax)
mov    %ecx,%eax
xor    %edx,%edx
div    %esi
jmp    1178 <main+0x58>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%llu\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 i8*
%8 = alloca i64
store i32 0, i32* %1
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %4)
store i64 0, i64* %5
br label %10
10: ; preds = %54, %0
%11 = load i64, i64* %5
%12 = load i64, i64* %4
%13 = icmp ult i64 %11, %12
br i1 %13, label %14, label %57
14: ; preds = %10
%15 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %2)
store i64 0, i64* %6
%16 = load i64, i64* %2
%17 = call i8* @llvm.stacksave()
store i8* %17, i8** %7
%18 = alloca i64, i64 %16
store i64 %16, i64* %8
store i64 0, i64* %3
br label %19
19: ; preds = %40, %14
%20 = load i64, i64* %3
%21 = load i64, i64* %2
%22 = icmp ult i64 %20, %21
br i1 %22, label %23, label %43
23: ; preds = %19
%24 = load i64, i64* %3
%25 = getelementptr inbounds i64, i64* %18, i64 %24
%26 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %25)
%27 = load i64, i64* %3
%28 = getelementptr inbounds i64, i64* %18, i64 %27
%29 = load i64, i64* %28
%30 = load i64, i64* %2
%31 = urem i64 %29, %30
%32 = load i64, i64* %6
%33 = add i64 %32, %31
store i64 %33, i64* %6
%34 = load i64, i64* %6
%35 = load i64, i64* %2
%36 = urem i64 %34, %35
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %23
store i64 0, i64* %6
br label %39
39: ; preds = %38, %23
br label %40
40: ; preds = %39
%41 = load i64, i64* %3
%42 = add i64 %41, 1
store i64 %42, i64* %3
br label %19
43: ; preds = %19
%44 = load i64, i64* %6
%45 = load i64, i64* %2
%46 = urem i64 %44, %45
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %43
%49 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %52
50: ; preds = %43
%51 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %52
52: ; preds = %50, %48
%53 = load i8*, i8** %7
br label %54
54: ; preds = %52
%55 = load i64, i64* %5
%56 = add i64 %55, 1
store i64 %56, i64* %5
br label %10
57: ; preds = %10
ret i32 0
}

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