about summary refs log tree commit diff
path: root/codechef/jain.py
blob: 86010721cda7cc0a38d701f0735bc27e363e93f2 (plain) (blame)
1
2
3
4
5
6
#!/usr/bin/env python3
from itertools import combinations

for _ in range(int(input())):
    print(sum(len(a | b) == 5 for a, b in combinations(
        (set(input()) for d in range(int(input()))), 2)))