t = int(input()) for ti in range(t): n = int(input()) cities = set() for ni in range(n): cities.add(input().strip()) print(len(cities))