return sort {$permutation{$a} <=> $permutation{$b} || $a cmp $b} keys %permutation;