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