Help me in solving PETSTORE problem with the concept of multiset

My issue

My code

for i in range(int(input())):
    n=int(input())
    type=[int(x) for x in range(n)]
    

Problem Link: PETSTORE Problem - CodeChef

@nivedha_502
it means both alice and both after buying the pet must contains exact same pets in number like 1 2 2 1 can be broken into 1 2 and 1 2 which is exact same.