#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, int *);
int main() {
  int n, i, tmp;
  while (scanf("%d", &n) != EOF) {
    for (i = 0; i < n; i++) {
      scanf("%d", &tmp);
      if (tmp % 2 == 1)
        printf("0 0\n");
      else if (tmp % 4 == 0)
        printf("%d %d\n", tmp / 4, tmp / 2);
      else if (tmp % 2 == 0)
        printf("%d %d\n", (tmp - tmp % 4) / 4 + 1, tmp / 2);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    0x2ea2(%rip),%rcx
cmp    (%rcx),%rax
je     124e <main+0x12e>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1249 <main+0x129>
lea    0xe97(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    1199 <main+0x79>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1236 <main+0x116>
mov    -0x10(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11da <main+0xba>
mov    -0x10(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1231 <main+0x111>
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    122c <main+0x10c>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
sub    %edx,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
add    $0x1,%esi
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1231 <main+0x111>
jmp    1236 <main+0x116>
jmp    123b <main+0x11b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1156 <main+0x36>
jmp    112f <main+0xf>
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
push   %rax
lea    0xebe(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    0x2e97(%rip),%rbp
cmp    0x0(%rbp),%rax
jne    1168 <main+0x38>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe91(%rip),%rbx
lea    0x4(%rsp),%r14
lea    0xe8f(%rip),%r15
lea    0xe81(%rip),%r12
jmp    11a1 <main+0x71>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
cmp    0x0(%rbp),%rax
je     1157 <main+0x27>
cmpl   $0x0,(%rsp)
jle    1190 <main+0x60>
xor    %r13d,%r13d
jmp    11c2 <main+0x92>
nopl   0x0(%rax)
mov    %r15,%rdi
call   1030 <puts@plt>
add    $0x1,%r13d
cmp    (%rsp),%r13d
jge    1190 <main+0x60>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
mov    %edx,%esi
and    $0xfffffffe,%esi
mov    %eax,%ecx
sub    %esi,%ecx
cmp    $0x1,%ecx
je     11b0 <main+0x80>
sar    %edx
test   $0x3,%al
je     1200 <main+0xd0>
test   %ecx,%ecx
jne    11b8 <main+0x88>
lea    0x3(%rax),%esi
test   %eax,%eax
cmovns %eax,%esi
sar    $0x2,%esi
add    $0x1,%esi
jmp    120b <main+0xdb>
lea    0x3(%rax),%esi
test   %eax,%eax
cmovns %eax,%esi
sar    $0x2,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11b8 <main+0x88>

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

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