import scala.io.StdIn.readInt
import scala.collection.mutable.ArrayBuffer

object Main {
  def sieve(n:Int) = {
    val primes = Array.tabulate(n+1) { _ % 2 }
    primes(1) = 0
    primes(2) = 1

    for( i <- 3 to Math.sqrt(n).toInt by 2 )
    {
      if(primes(i) == 1)
        (i*i to n by i*2).foreach { primes(_) = 0 }
    }
    primes
  }

  def main(args:Array[String]) = {
    val p = sieve(10001)
    val b = new ArrayBuffer[String]
    var i = 0
    while({i=readInt;i}!=0) {
      val n =if(i.toInt % 2 == 0) i.toInt-1 else i.toInt
      b += (n to 5 by -2).find( j=> p(j)==1 && p(j-2)==1 ).map( j=>(j-2)+" "+j ).get
    }
    println( b.mkString("\n") )
  }
}