#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int sum, i, N, T;
  long long j;
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &N);
    for (i = sum = 0; i < N; ++i, sum = (sum + j) % N) {
      scanf("%lld", &j);
    }
    if (sum) {
      puts("NO");
    } else {
      puts("YES");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     11e3 <main+0xc3>
lea    0xea4(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11b7 <main+0x97>
lea    0xe7b(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movslq -0x8(%rbp),%rax
add    -0x20(%rbp),%rax
movslq -0x10(%rbp),%rcx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,-0x8(%rbp)
jmp    1175 <main+0x55>
cmpl   $0x0,-0x8(%rbp)
je     11d2 <main+0xb2>
lea    0xe40(%rip),%rdi
call   1030 <puts@plt>
jmp    11de <main+0xbe>
lea    0xe32(%rip),%rdi
call   1030 <puts@plt>
jmp    1141 <main+0x21>
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
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,0x8(%rsp)
jae    1159 <main+0x39>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xea0(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xe97(%rip),%r12
lea    0x10(%rsp),%r13
jmp    1193 <main+0x73>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xe84(%rip),%rdi
call   1030 <puts@plt>
subl   $0x1,0x8(%rsp)
jb     1148 <main+0x28>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1180 <main+0x60>
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    11bc <main+0x9c>
nopl   (%rax)
cqto
idiv   %rcx
mov    %rdx,%rbx
cmp    %ecx,%ebp
jge    11ef <main+0xcf>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movslq %ebx,%rax
add    0x10(%rsp),%rax
add    $0x1,%ebp
movslq 0xc(%rsp),%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
jne    11b0 <main+0x90>
xor    %edx,%edx
div    %ecx
mov    %edx,%ebx
cmp    %ecx,%ebp
jl     11bc <main+0x9c>
lea    0xe12(%rip),%rdi
test   %ebx,%ebx
jne    1187 <main+0x67>
jmp    1180 <main+0x60>

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

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