Жишээ тэстүүд

Оролт
2 2
Гаралт
2 1 
Оролт
3 2
Гаралт
1 3 2 

Тэмдэглэл

In the first example, both permutations of numbers {1, 2} yield maximum possible f(p) which is equal to 4. Among them, (2, 1) comes second in lexicographical order.