#别人的算法,非常牛逼
#首先寻找素数,除数的范围是(2,根号x)
def issushu(x):
  if x <= 2:
      return True
  else:
      for i in range(2, int(x ** 0.5) + 1):
          if x % i == 0:
              return False
      else:
          return True
#遍历的时候,从中间向两边遍历,牛逼
while True:
    try:
        n = int(input())
        for i in range(int(n / 2), n):
            if issushu(i) and issushu(n - i):
                print(n - i)
                print(i)
                break
    except:
        break


#我的笨办法,时间长,且占用空间多
n=int(input())

list1=[]
for x in range(2,n):
    flag=-1
    for y in range(2,int(n**0.5)):
        if x%y==0:
            flag=1
            break
    if flag==-1:
        list1.append(x)  
        
list2=[]  
for x in list1:
    
    if x<=n-x and n-x in list1:
        list2.append([x,(n-x)])

list3=[]
for x in list2:
    list3.append(x[1]-x[0])

for x in list2[list3.index(min(list3))]:
    print(x, end='\n')