import sys
import heapq
count = int(input())
def is_prime(n):
for i in range(2, n):
if n % i == 0:
return False
return True
def find_primes(n):
primes = []
for i in range(2, n):
if is_prime(i):
primes.append(i)
return primes
for _ in range(count):
num = int(input())
# print(num)
primes = find_primes(num)
h = []
for p in primes:
for r in primes:
if p+r == num:
heapq.heappush(h, (abs(p-r), p, r))
a, b, c = heapq.heappop(h)
print(b, c)
# n이하의 숫자들 중 소수 찾기
def prime_list(n):
sieve = [True] * n
m = int(n ** 0.5)
for i in range(2, m + 1):
if sieve[i] == True:
for j in range(i+i, n, i):
sieve[j] = False
return [i for i in range(2, n) if sieve[i] == True]
# n이하의 소수들 중 합이 n
def sosu(n):
li=prime_list(n)
idx = max([i for i in range(len(li)) if li[i]<=n/2])
for i in range(idx,-1,-1):
for j in range(i,len(li)):
if li[i]+li[j]==n:
return [li[i],li[j]]
for _ in range(int(input())):
n=int(input())
print(" ".join(map(str,sosu(n))))