let rec s = function
  | 0 -> 0
  | n -> n mod 10 + s (n / 10)

let p x y = x * s y <= y * s x

let bases = Array.to_list @@ Array.init 16 (fun d -> int_of_float (10. ** float_of_int d))

let solutions =
  Array.init 1000 (fun i ->
    List.filter (fun r ->
      p ((i + 1) * r - 1) ((i - i mod 10 + 10) * r - 1) &&
      p ((i + 1) * r - 1) ((i - i mod 100 + 100) * r - 1) &&
      p ((i + 1) * r - 1) ((i - i mod 1000 + 1000) * r - 1)) bases
    |> List.map (fun r -> (i + 1) * r - 1))
  |> Array.to_list
  |> List.concat
  |> List.sort_uniq compare
  |> Array.of_list

let () = Scanf.scanf "%d" @@ fun k ->
  for i = 1 to k do
    Printf.printf "%d\n" solutions.(i - 1)
  done

