Var
n, m, x, y, i: int64;
ar: array[1..100000]of int64;
ms: array[1..100000]of int64;
begin
read(n, m);
for i := 1 to n do
begin
ar[i] := i;
ms[i] := i;
end;
for i := 1 to m do
begin
read(x, y);
swap(ms[x], ms[y]);
swap(ar[ms[x]], ar[ms[y]]);
end;
for i := 1 to n do write(ar[i], ' ');
end.