Stephen Queen wants to write a story. He is a very unusual writer, he uses only letters 'a', 'b', 'c', 'd' and 'e'!

To compose a story, Stephen wrote out n words consisting of the first 5 lowercase letters of the Latin alphabet. He wants to select the maximum number of words to make an interesting story.

Let a story be a sequence of words that are not necessarily different. A story is called interesting if there exists a letter which occurs among all words of the story more times than all other letters together.

For example, the story consisting of three words "bac", "aaada", "e" is interesting (the letter 'a' occurs 5 times, all other letters occur 4 times in total). But the story consisting of two words "aba", "abcde" is not (no such letter that it occurs more than all other letters in total).

You are given a sequence of n words consisting of letters 'a', 'b', 'c', 'd' and 'e'. Your task is to choose the maximum number of them to make an interesting story. If there's no way to make a non-empty story, output 0.

Input

The first line contains one integer t (1 ≤ t ≤ 5000) — the number of test cases. Then t test cases follow.

The first line of each test case contains one integer n (1 ≤ n ≤ 2 ⋅ 10^5) — the number of the words in the sequence. Then n lines follow, each of them contains a word — a non-empty string consisting of lowercase letters of the Latin alphabet. The words in the sequence may be non-distinct (i. e. duplicates are allowed). Only the letters 'a', 'b', 'c', 'd' and 'e' may occur in the words.

It is guaranteed that the sum of n over all test cases doesn't exceed 2 ⋅ 10^5; the sum of the lengths of all words over all test cases doesn't exceed 4 ⋅ 10^5.

Output

For each test case, output the maximum number of words that compose an interesting story. Print 0 if there's no way to make a non-empty interesting story.

Example

Input


6
3
bac
aaada
e
3
aba
abcde
aba
2
baba
baba
4
ab
ab
c
bc
5
cbdca
d
a
d
e
3
b
c
ca


Output


3
2
0
2
3
2

Note

In the first test case of the example, all 3 words can be used to make an interesting story. The interesting story is "bac aaada e".

In the second test case of the example, the 1-st and the 3-rd words can be used to make an interesting story. The interesting story is "aba aba". Stephen can't use all three words at the same time.

In the third test case of the example, Stephen can't make a non-empty interesting story. So the answer is 0.

In the fourth test case of the example, Stephen can use the 3-rd and the 4-th words to make an interesting story. The interesting story is "c bc".
//import jdk.nashorn.internal.parser.Scanner;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.*;
import java.util.*;

import javax.management.Query;
public class Test{
    public static void main(String[] args) throws IOException, InterruptedException{
      Scanner sc = new Scanner(System.in);
     int t = sc.nextInt();
    
     while(t-->0){
      int n = sc.nextInt();
      String [] words = new String[n];
     
      for(int i =0;i<n;i++){
        words[i] = sc.nextLine();
       
      }
      int maxRes =0;
      for(int i =0;i<5;i++){
      int maxChar = 'a' +i;
      
      PriorityQueue<Pair> pq = new PriorityQueue<>();
      for (String word : words){
          pq.add(new Pair(word,occOfMaxChar(word, maxChar)-occOfOtherChar(word, maxChar)));
      }
      int res = 0;
      int curr = 0;
      int maxCharCount = 0;
      int otherCharCount =0;
      while(!pq.isEmpty()){
        String word = pq.poll().x;
        maxCharCount +=occOfMaxChar(word, maxChar);
         otherCharCount += occOfOtherChar(word, maxChar);
         curr ++;
         if(maxCharCount >otherCharCount){
           res = curr;
         }
          
      }
      maxRes = Math.max(maxRes, res);
    }
    System.out.println(maxRes);}
   
  }
  public static int occOfMaxChar (String s, int maxChar){
     int occ = 0;
     for(int i =0 ;i<s.length();i++){
       if(s.charAt(i)==maxChar){
         occ++;
       }
      }
      return occ;
  }
  public static int occOfOtherChar (String s, int maxChar){
    int occ = 0;
    for(int i =0 ;i<s.length();i++){
      if(s.charAt(i)!=maxChar){
        occ++;
      }
     }
     return occ;
 }

    static int w;
    static int n;
    static long [][] memo;
    static int [] depth ;
    static long[] values;
    static ArrayList<Pair> gold ;
    public static long dp (int idx,int time){
      if ( idx == n){
       return 0;
      }
      if (memo[idx][time] != -1){
        return  memo[idx][time];
      }
      long take = 0;
      if (3 * w*depth[idx] <= time){
        take = values[idx]+ dp(idx+1, time-3*w*depth[idx]);
      }
      long leave = dp(idx+1, time);
      return memo[idx][time]=Math.max(take, leave);
    }


    static class Pair implements Comparable {
      String x;
      int y;
      public Pair (String x, int y) {
        this.x = x;
        this.y = y;
      }
      @Override
      public int compareTo(Object o){
        Pair p = (Pair) o;
        return p.y -y;
      }
    }
    static class Scanner {
      StringTokenizer st;
      BufferedReader br;
   
      public Scanner(InputStream s) {
        br = new BufferedReader(new InputStreamReader(s));
      }
   
      public boolean hasNext() {
        // TODO Auto-generated method stub
        return false;
      }
   
      public String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
          st = new StringTokenizer(br.readLine());
        return st.nextToken();
      }
   
      public int nextInt() throws IOException {
        return Integer.parseInt(next());
      }
   
      public long nextLong() throws IOException {
        return Long.parseLong(next());
      }
   
      public String nextLine() throws IOException {
        return br.readLine();
      }
   
      public double nextDouble() throws IOException {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if (x.charAt(0) == '-') {
          neg = true;
          start++;
        }
        for (int i = start; i < x.length(); i++)
          if (x.charAt(i) == '.') {
            res = Long.parseLong(sb.toString());
            sb = new StringBuilder("0");
            dec = true;
          } else {
            sb.append(x.charAt(i));
            if (dec)
              f *= 10;
          }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg ? -1 : 1);
      }
   
      public boolean ready() throws IOException {
        return br.ready();
      }
   
    }
     }
