let w=read_int()and n=read_int()open Array;;let z=init w(fun i->i+1);;let rec f i=if i=n then iter(fun e->Printf.printf"%d
"e)z else Scanf.scanf"%d,%d
"(fun a b->let t=z.(a-1)in z.(a-1)<-z.(b-1);z.(b-1)<-t;f(i+1));;f 0