#include <iostream>
#include <map>
using namespace std;

int main()
{
  int t;
  cin>>t;
  while(t--)
  {
   	map<int, int> mymap; 
    int n;
    cin>>n;

    for(int i=0;i<n;i++) {
        string s;
        cin>>s;
        int bm=0;
        for(int j=0;j<s.length();j++)
            bm |= (1<<(s[j]-'a'));
        mymap[bm]++;
    }
    int complete = (1<<('a'-'a')) | (1<<('e'-'a')) | (1<<('i'-'a')) | (1<<('o'-'a')) | (1<<('u'-'a'));
    int count = 0;
    int comparisons = 0; 
    for (auto i=mymap.begin(); i!=mymap.end(); i++)  {
    	auto j=i; 
        for(++j;j!=mymap.end();j++) {
        	comparisons++; 
        	if((i->first | j->first)==complete) {
        	    count += i->second * j->second; 
        	    cout << i->first <<" "<<j->first<<" :"<<i->second<<" "<<j->second<<endl;
        	}
        }
    }
    auto special = mymap.find(complete); 
    if (special!=mymap.end()) {
        count += special->second * (special->second -1) / 2; 
    }
    cout<<"Result: "<<count<<" (found in "<<comparisons<<" comparisons)\n";
  }
  return 0;
}
