def prime(m):

  N = list(range(1,m+2, 2))

  r = int(m**.5)

  h = len(N)

  N[0] = 0

  for i in range(h):

    x = N[i]

    if x>r: break

    if x and i+x<h: N[i+x:h:x]=[0] * ((h-1-i-x)/x+1)

  N[0] = 2

  return [_f for _f in N if _f]



P = prime(10000)

x = [a for a,b in zip(P[1:],P[:-2]) if a-b==2]

while 1:

  n = eval(input())

  if n==0: break

  for e in x:

    if e>n: break

    a = e

  print(a-2,a)
import bisect as bs

def prime(m):

  N = list(range(1,m+1, 2))

  N[0] = 2

  for i in range(1, int(m**.5)+1):

    x = N[i]

    if x: N[i+x::x] = [0] * len(N[i+x::x])

  return [_f for _f in N if _f]



P = prime(10000)

x = [P[i] for i in range(1,len(P)) if P[i] - P[i-1]==2]

while 1:

  n = eval(input())

  if n==0: break

  a = x[bs.bisect_right(x, n)-1]

  print(a-2, a)
def prime(m):
    N = list(range(1, m + 2, 2))
    r = int(m**0.5)
    h = len(N)
    N[0] = 0
    for i in range(h):
        x = N[i]
        if x > r:
            break
        if x and i + x < h:
            N[i + x : h : x] = [0] * ((h - 1 - i - x) / x + 1)
    N[0] = 2
    return [_f for _f in N if _f]


P = prime(10000)
x = [a for a, b in zip(P[1:], P[:-2]) if a - b == 2]
while 1:
    n = eval(input())
    if n == 0:
        break
    for e in x:
        if e > n:
            break
        a = e
    print(a - 2, a)

import bisect as bs


def prime(m):
    N = list(range(1, m + 1, 2))
    N[0] = 2
    for i in range(1, int(m**0.5) + 1):
        x = N[i]
        if x:
            N[i + x :: x] = [0] * len(N[i + x :: x])
    return [_f for _f in N if _f]


P = prime(10000)
x = [P[i] for i in range(1, len(P)) if P[i] - P[i - 1] == 2]
while 1:
    n = eval(input())
    if n == 0:
        break
    a = x[bs.bisect_right(x, n) - 1]
    print(a - 2, a)

+import bisect as bs + + -    N = list(range(1, m + 2, 2)) -    r = int(m**0.5) -    h = len(N) -    N[0] = 0 -    for i in range(h): +    N = list(range(1, m + 1, 2)) +    N[0] = 2 +    for i in range(1, int(m**0.5) + 1): -        if x > r: -            break -        if x and i + x < h: -            N[i + x : h : x] = [0] * ((h - 1 - i - x) / x + 1) -    N[0] = 2 +        if x: +            N[i + x :: x] = [0] * len(N[i + x :: x]) -x = [a for a, b in zip(P[1:], P[:-2]) if a - b == 2] +x = [P[i] for i in range(1, len(P)) if P[i] - P[i - 1] == 2] -    for e in x: -        if e > n: -            break -        a = e +    a = x[bs.bisect_right(x, n) - 1]