
object Main extends App {
  import scala.io.StdIn._
  import scala.math._
  var n = readLine.trim.toInt
  while(n != 0){
    println(maxFloor(n * 2))
    n = readLine.trim.toInt
  }
  def maxFloor(n: Long): String = {
    var max = sqrt(n).floor.toInt
    while (n % max != 0 || (n / max - max) % 2 != 1){
      max -= 1
    }
    val diff = ((n / max - max) - 1) / 2
    s"${diff + 1} $max"
  }
}
