Azamon Barma

0

0 votes
Problem

Problem Statement

Barma, for his summer vacations, decided to go to the beautiful hills of Himachal. But there's a problem, all of his N friends want to go with him. Sadly, Barma's bike can occupy exactly  4 people (Not 3 nor 2 nor 1) including Barma. Barma decided that the 3 people that will accompany him should have at least 1 character common in their names that is not a consonant. 
Given the list of names of Barma's N friends, help Barma in finding out the number of ways in which he can choose his trip companions.  Two ways are considered different only if at least one of the chosen friends is different.

 

Input

The first line consists of integer TT test cases follow. The first line of each test case consists of an integer N, denoting the number of Barma's friends. It is followed by N lines, wherein each line is a string having only lowercase alphabets ('a'-'z') without spaces, denoting the names of friends. A name can have a maximum length of 15 characters.

Output

For each case print the required number of ways on a new line.


Constraints:

1T20

1N104

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

?