#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*/ freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  freopen("input.txt", "r", stdin);
  int a, n;
  scanf("%d", &n);
  while (n--) {
    scanf("%d", &a);
    if (a % 2) {
      printf("0 0\n");
    } else {
      if (a % 4) {
        printf("%d %d\n", a / 4 + 1, a / 2);
      } else {
        printf("%d %d\n", a / 4, a / 2);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%edx
lea    0xeaa(%rip),%rdi
lea    0xead(%rip),%rsi
call   1040 <freopen@plt>
lea    0xea3(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x18(%rbp)
cmp    $0x0,%eax
je     1233 <main+0x103>
lea    0xe7f(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11bd <main+0x8d>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122e <main+0xfe>
mov    -0x14(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1201 <main+0xd1>
mov    -0x14(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
add    $0x1,%esi
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1229 <main+0xf9>
mov    -0x14(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122e <main+0xfe>
jmp    1172 <main+0x42>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
lea    0xea8(%rip),%rdi
lea    0xeab(%rip),%rsi
call   1050 <freopen@plt>
lea    0xea1(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
subl   $0x1,(%rsp)
jb     11ec <main+0xac>
lea    0xe8c(%rip),%r14
lea    0x4(%rsp),%rbx
lea    0xe83(%rip),%r15
lea    0xe83(%rip),%r12
jmp    11ae <main+0x6e>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12,%rdi
call   1030 <puts@plt>
subl   $0x1,(%rsp)
jb     11ec <main+0xac>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
test   $0x1,%al
jne    11a0 <main+0x60>
lea    0x3(%rax),%esi
test   %eax,%eax
cmovns %eax,%esi
sar    $0x2,%esi
test   $0x3,%al
je     11d3 <main+0x93>
add    $0x1,%esi
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
sar    %edx
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
subl   $0x1,(%rsp)
jae    11ae <main+0x6e>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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