/ /&&--$c[++$c[${$`}],${$`}=$'+1]for<>;print-$_,$/for@c[1..8]