fun readInt () = valOf (TextIO.scanStream (Int.scan StringCvt.DEC) TextIO.stdIn) fun printAns n = let val index = ref 0 val digits = List.tabulate (n, fn i => 9 - i) val count = ref 0 in while !index < n do ( count := 0; while !count < n do ( print (Int.toString (List.nth(digits, !index))); count := !count + 1 ); index := !index + 1 ); print "\n" end val () = let val n = readInt () in printAns n end