<>;<>;@X=<>;$a[$_-1]=++$%for glob pop@X;for$t(@a){$t+=($t==$_)-($t==$_+1)for@X,@x;push@x,$t..$i++,map-$_,1-$t..-$i}print@x.$/,map"$_ ".++$_.$/,@x