2025-07-16 21:53:33 +09:00

9 lines
255 B
Python

for _ in range(int(input())):
clothes = {}
for _ in range(int(input())):
name, type = input().split()
clothes[type] = clothes.get(type,0) + 1
result = 1
for n in clothes.values():
result *= (n+1)
print(result-1)