$n=A; print chop,$/for reverse sort map{/ /;sprintf"%d%3d".$n++,$`,110-$'}<>