Scanf.scanf "%d %d\n" (fun n m ->
  let r2 = Array.make (n+1) [] in
  for i=0 to m-1 do
     Scanf.scanf "%d %d\n" (fun p1 y1->
       r2.(p1) <- y1::r2.(p1);
    )
  done;
  for i=1 to n do
    r2.(i) |> List.iteri(fun v j ->
    Printf.printf "%06d%06d\n" i (v+1)
    )
  done;
)
