main :: IO ()
main = do
  n <- readLn
  if n == 0
    then return ()
    else do
      putStrLn $ solve n
      main

solve :: Int -> String
solve n = format (findTwin n primeT)
  where
    format :: (Int,Int) -> String
    format (a,b) = (show a) ++ " " ++ (show b)

    findTwin :: Int -> [(Int,Int)] -> (Int,Int)
    findTwin n ((a,b):rt)
      | b <= n = (a,b)
      | otherwise = findTwin n rt
prime :: Int -> [Int]
prime n = loop [2..n]
  where
    loop :: [Int] -> [Int]
    loop [] = []
    loop (x:xs) = x:(loop (filter (\y -> y `mod` x /= 0) xs))
primeL = prime 10000
primeT = reverse (makeT primeL)
  where
    makeT :: [Int] -> [(Int,Int)]
    makeT [x] = []
    makeT (x:y:r)
      | y - x == 2 = (x,y):(makeT (y:r))
      | otherwise = makeT (y:r)