Bob's Journey

3.9

9 votes
Open, Approved, Hashing, Easy
Problem

Bob is travelling from one city to another. In his way, he sees many other cities pass by. What he does instead of learning the full names of the cities, he learns just the first character of the cities. For example, if he passes by "bhopal", he will just remember the 'b'.

Given the list of N cities that come in his way, print "YES" or "NO" depending on if he is able to remember all the cities distinctly or not.

Note: City name consists of small English alphabets only.

Input and Output:
First line contains T, the number of testcases. Each testcase consists of N, the number of cities. Next N lines contain the names of the cities.
For each testcase, print "YES" or "NO" (quotes for clarity).

Constraints:
1 ≤ T ≤ 100
1 ≤ N ≤ 1000
1 ≤ Length of each city name ≤ 10

Time Limit: 2
Memory Limit: 256
Source Limit:
Editor Image

?