#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 gcd(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int t, n, i, g;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    int a[n];
    scanf("%d", &a[0]);
    g = a[0];
    for (i = 1; i < n; ++i) {
      scanf("%d", &a[i]);
      g = gcd(g, a[i]);
    }
    for (i = 0; i < n; ++i)
      printf("%d ", a[i] / g);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%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     125b <main+0x12b>
lea    0xe96(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x30(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x28(%rbp)
lea    0xe5f(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1201 <main+0xd1>
mov    -0x30(%rbp),%rsi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe28(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x30(%rbp),%rax
mov    -0x14(%rbp),%edi
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1050 <gcd@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11b6 <main+0x86>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1241 <main+0x111>
mov    -0x30(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,%esi
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1208 <main+0xd8>
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
jmp    114f <main+0x1f>
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    $0x18,%rsp
lea    0xea8(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <scanf@plt>
subl   $0x1,-0x30(%rbp)
jae    1178 <main+0x38>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe81(%rip),%rbx
lea    -0x2c(%rbp),%r15
jmp    11ab <main+0x6b>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x38(%rbp),%rsp
subl   $0x1,-0x30(%rbp)
lea    0xe57(%rip),%rbx
jb     1167 <main+0x27>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    %rsp,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%r14
mov    %rbx,%rdi
lea    0xf(,%rax,4),%rbx
and    $0xfffffffffffffff0,%rbx
mov    %r14,%r13
sub    %rbx,%r13
mov    %r13,%rsp
neg    %rbx
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    (%r14,%rbx,1),%r12d
mov    -0x2c(%rbp),%eax
cmp    $0x2,%eax
jl     122e <main+0xee>
lea    0x4(%r13),%r14
mov    $0x1,%r15d
lea    0xe00(%rip),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    (%r14),%esi
mov    %r12d,%edi
call   1060 <gcd@plt>
mov    %eax,%r12d
add    $0x1,%r15
movslq -0x2c(%rbp),%rax
add    $0x4,%r14
cmp    %rax,%r15
jl     1200 <main+0xc0>
lea    -0x2c(%rbp),%r15
lea    0xdce(%rip),%r14
test   %eax,%eax
jle    1190 <main+0x50>
xor    %ebx,%ebx
nop
mov    0x0(%r13,%rbx,4),%eax
cltd
idiv   %r12d
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
cmp    %rax,%rbx
jl     1240 <main+0x100>
jmp    1190 <main+0x50>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %9
9: ; preds = %57, %0
%10 = load i32, i32* %2
%11 = add nsw i32 %10, -1
store i32 %11, i32* %2
%12 = icmp ne i32 %10, 0
br i1 %12, label %13, label %60
13: ; preds = %9
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %3
%16 = zext i32 %15 to i64
%17 = call i8* @llvm.stacksave()
store i8* %17, i8** %6
%18 = alloca i32, i64 %16
store i64 %16, i64* %7
%19 = getelementptr inbounds i32, i32* %18, i64 0
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %19)
%21 = getelementptr inbounds i32, i32* %18, i64 0
%22 = load i32, i32* %21
store i32 %22, i32* %5
store i32 1, i32* %4
br label %23
23: ; preds = %38, %13
%24 = load i32, i32* %4
%25 = load i32, i32* %3
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %41
27: ; preds = %23
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %18, i64 %29
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %30)
%32 = load i32, i32* %5
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %18, i64 %34
%36 = load i32, i32* %35
%37 = call i32 @gcd(i32 %32, i32 %36)
store i32 %37, i32* %5
br label %38
38: ; preds = %27
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
br label %23
41: ; preds = %23
store i32 0, i32* %4
br label %42
42: ; preds = %54, %41
%43 = load i32, i32* %4
%44 = load i32, i32* %3
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %57
46: ; preds = %42
%47 = load i32, i32* %4
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i32, i32* %18, i64 %48
%50 = load i32, i32* %49
%51 = load i32, i32* %5
%52 = sdiv i32 %50, %51
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %52)
br label %54
54: ; preds = %46
%55 = load i32, i32* %4
%56 = add nsw i32 %55, 1
store i32 %56, i32* %4
br label %42
57: ; preds = %42
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%59 = load i8*, i8** %6
br label %9
60: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = add nsw i32 %6, -1
store i32 %7, i32* %1
%8 = icmp eq i32 %6, 0
br i1 %8, label %49, label %9
9: ; preds = %0, %44
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
%14 = alloca i32, i64 %12
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %14)
%16 = load i32, i32* %14
%17 = load i32, i32* %2
%18 = icmp sgt i32 %17, 1
br i1 %18, label %23, label %19
19: ; preds = %23, %9
%20 = phi i32 [ %17, %9 ], [ %31, %23 ]
%21 = phi i32 [ %16, %9 ], [ %29, %23 ]
%22 = icmp sgt i32 %20, 0
br i1 %22, label %34, label %44
23: ; preds = %9, %23
%24 = phi i64 [ %30, %23 ], [ 1, %9 ]
%25 = phi i32 [ %29, %23 ], [ %16, %9 ]
%26 = getelementptr inbounds i32, i32* %14, i64 %24
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %26)
%28 = load i32, i32* %26
%29 = call i32 @gcd(i32 %25, i32 %28)
%30 = add nuw nsw i64 %24, 1
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = icmp slt i64 %30, %32
br i1 %33, label %23, label %19
34: ; preds = %19, %34
%35 = phi i64 [ %40, %34 ], [ 0, %19 ]
%36 = getelementptr inbounds i32, i32* %14, i64 %35
%37 = load i32, i32* %36
%38 = sdiv i32 %37, %21
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = add nuw nsw i64 %35, 1
%41 = load i32, i32* %2
%42 = sext i32 %41 to i64
%43 = icmp slt i64 %40, %42
br i1 %43, label %34, label %44
44: ; preds = %34, %19
%45 = call i32 @putchar(i32 10)
%46 = load i32, i32* %1
%47 = add nsw i32 %46, -1
store i32 %47, i32* %1
%48 = icmp eq i32 %46, 0
br i1 %48, label %49, label %9
49: ; preds = %44, %0
ret i32 0
}