import sys
input = sys.stdin.readline
def prime_number(n):
number_list = [True] * (n+1)
return_list = []
for i in range(2, n+1):
if (number_list[i] == True):
return_list.append(i)
for j in range(2*i, n+1, i):
number_list[j] = False
return return_list
def sosu(prime):
global n
idx = max([i for i in range(len(prime)) if prime[i] <= n//2])
for i in range(idx, -1, -1):
for j in range(idx, len(prime)):
if(prime[i] + prime[j] == n):
return [prime[i], prime[j]]
t = int(input())
for _ in range(t):
n = int(input())
result = sosu(prime_number(n))
print(f'{result[0]} {result[1]}')
import sys
input = sys.stdin.readline
t = int(input())
def prime_number(n):
number_list = [True] * (n+1)
return_list = []
for i in range(2, n+1):
if (number_list[i] == True):
return_list.append(i)
for j in range(2*i, n+1, i):
number_list[j] = False
else:
continue
return return_list
for _ in range(t):
n = int(input())
prime = prime_number(n)
result = []
prime_max = 1000001
for i in range(len(prime)):
if(prime[i] > n//2):
break
for j in range(len(prime)-1, -1, -1):
if(prime[i] + prime[j] == n):
if(prime[j] - prime[i] <= prime_max):
result.append([prime[i], prime[j]])
prime_max = prime[j] - prime[i]
break
else:
continue
print(f'{result[-1][0]} {result[-1][1]}')