require 'prime'
while line = gets
n = line.chomp.to_i
break if n == 0
ary = Prime.each(n).to_a
result = []
  for i in 0...(ary.size - 1)
    if ary[i + 1] - ary[i] == 2
      result[0] = ary[i]
      result[1] = ary[i + 1]
  end
end
puts result.join(" ")
end
