h=b[x] g=b[x-1] f=t=h,$h=g,$g=t b=({0..99}) read n read k for((;k--;f)){ read x y } read -aa for((x=1;x;++c)){ d+=" $x "$[x+1] for((f,x=n;--x&&a[g]