#!perl map$_{"@{[sort/./g]}"}.=$_,sort<>;@$_>1&&print"@$_$/"for sort{@$a-@$b||"@$a"cmp"@$b"}map[split],values%_