// Arup Guha
// 3/6/2020
// Solution to Problem 2015 RMRC Problem: I've Been Everywhere, Man
// on Katitis used for JK-Mar7-2020 contest

import java.util.*;

public class everywhere {

	public static void main(String[] args) {
	
		Scanner stdin = new Scanner(System.in);
		int nC = stdin.nextInt();
		int res = 0;
		
		// Process each case.
		for (int loop=0; loop<nC; loop++) {
			
			HashSet<String> cities = new HashSet<String>();
			int n = stdin.nextInt();
			
			// Just add each city into the set...
			for (int i=0; i<n; i++)
				cities.add(stdin.next());
				
			// They just want the size of the set!
			System.out.println(cities.size());
		}
	}
}