$"='';$n=@_=<>=~/./g;for$i(0..--$n){@a=@_,$a[$i]=$_[$_],$a[$_]=$_[$i],$\<"@a"?$\="@a":0for$i..$n}print