sub f{@a=();for(@_){push @_,shift;push @a,"@_"}@a}push@_,f split while <>;print join "\n",sort @_