let make_list f t step =
  let rec make_list_inner c t lst =
    if c >= t then lst else make_list_inner (c+step) t (c::lst)
  in
  List.rev (make_list_inner f t [])

let swap lst a b =
  let xa = Array.get lst (a-1) in
  let xb = Array.get lst (b-1) in
  lst.(a-1) <- xb;
  lst.(b-1) <- xa;
  lst
    
let () =
  let rec read lst =
    try let lst = (Scanf.scanf "%d,%d\n" (swap lst)) in
        read lst
    with End_of_file ->
         Array.iter (fun i -> (Printf.printf "%d\n" i)) lst
  in
  let w = int_of_string (read_line()) in
  let _ = int_of_string (read_line()) in
  read (Array.of_list (make_list 1 (w+1) 1))
;;




make_list 1 10 1;;