fun readInt () = valOf (TextIO.scanStream (Int.scan StringCvt.DEC) TextIO.stdIn) val () = let val n = readInt () exception E exception Found of (int * int) fun findAns i j = if 10 < i then raise E else if 10 < j then findAns (i + 1) 1 else if i + j = n then raise Found (i, j) else findAns i (j + 1) in (findAns 1 1) handle Found (a1, a2) => print (Int.toString a1 ^ " " ^ Int.toString a2 ^ "\n") end