SCU Practice Contest 2 In Summer

K: Unfriendly Multi Permutation