description: 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".
solution: import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.lang.reflect.Array;
  import java.math.BigInteger;
  import java.security.cert.CollectionCertStoreParameters;
  import java.util.*;
  
  
  
  import static javax.swing.UIManager.get;
  import static javax.swing.UIManager.getString;
  
  
  public class Main {
  
  
      static class Pair implements Comparable<Pair>{
          int x=0;
          String s="";
          public Pair(int x1,String str)
          { x=x1;
              s=str;
          }
  
  
          @Override
          public int compareTo(Pair o) {
              return this.x-o.x;
          }
      }
  
      static boolean checkPallindrome(int n)
      {    ArrayList<Integer> list = new ArrayList<>();
          while(n>0)
          { list.add(n%10);
              n/=10;
          }
          int low=0,high=list.size()-1;
          while(low<=high)
          {     if(list.get(low)!=list.get(high))
              return false;
              low++;
              high--;
          }
          return true;
      }
  
  
      static boolean check(String s)
      {
  
          int low=0,high=s.length()-1;
          while(low<=high)
          {     if(s.charAt(low)!=s.charAt(high))
              return false;
              low++;
              high--;
          }
          return true;
      }
  
      static  int min=Integer.MAX_VALUE;
      public static void main(String[] args) throws IOException {
          FastReader sc = new FastReader();
  //(1)very very important**(never take the first problem for granted, always check the test cases) take 5 minutes more and check the edge cases
          // 5 minutes will not decreases rating as much as a wrong submission does it is easy u just think with an open mind and u will surely get the answer
          //(2)let ur brain consume the problem don't just jump to the solution. after reading the problem take a pause 1 minute
          //(3)go through the example test cases and also at least two of ur own test cases.Think of testcases which are difficult(edge cases).dry run ur concept
  
          int t = sc.nextInt();
          while (t-- > 0) {
                int n=sc.nextInt();
                String[] str = new String[n];
                for(int i=0;i<n;i++)
                    str[i]=sc.nextLine();
  
                int[] temp1 = new int[n];
              int[] temp2 = new int[n];
              int[] temp3 = new int[n];
              int[] temp4 = new int[n];
              int[] temp5 = new int[n];
           int ind=0;
  
              int[] count = new int[5];
               for(int i=0;i<n;i++)
               {   for(int j=0;j<str[i].length();j++)
                    count[(int)str[i].charAt(j)-97]++;
  
                   temp1[ind]=count[0]-(count[1]+count[2]+count[3]+count[4]);
                   temp2[ind]=count[1]-(count[0]+count[2]+count[3]+count[4]);
                   temp3[ind]=count[2]-(count[1]+count[0]+count[3]+count[4]);
                   temp4[ind]=count[3]-(count[1]+count[2]+count[0]+count[4]);
                   temp5[ind]=count[4]-(count[1]+count[2]+count[3]+count[0]);
  
                   Arrays.fill(count,0);
                   ind++;
  
               }
  
               Arrays.sort(temp1);
              Arrays.sort(temp2);
              Arrays.sort(temp3);
              Arrays.sort(temp4);
              Arrays.sort(temp5);
               int max=0,count1=0,sum=0;
  
                     for(int i=temp1.length-1;i>=0;i--)
                         if(sum+temp1[i]>0)
                         { sum+=temp1[i];
                             count1++;
                         }
                   max=Math.max(count1,max);
                     count1=0;
                         sum=0;
              for(int i=temp2.length-1;i>=0;i--)
                  if(sum+temp2[i]>0)
                  { sum+=temp2[i];
                      count1++;
                  }
              max=Math.max(count1,max);
  
  
              count1=0;
              sum=0;
              for(int i=temp3.length-1;i>=0;i--)
                  if(sum+temp3[i]>0)
                  { sum+=temp3[i];
                      count1++;
                  }
              max=Math.max(count1,max);
  
  
              count1=0;
              sum=0;
              for(int i=temp4.length-1;i>=0;i--)
                  if(sum+temp4[i]>0)
                  { sum+=temp4[i];
                      count1++;
                  }
              max=Math.max(count1,max);
  
  
  
              count1=0;
              sum=0;
              for(int i=temp5.length-1;i>=0;i--)
                  if(sum+temp5[i]>0)
                  { sum+=temp5[i];
                      count1++;
                  }
              max=Math.max(count1,max);
  
               System.out.println(max);
  
          }
      }
  
  
  
  
  
  
  
  
  //Things to check when u r getting wrong answer
  // syntax of conditional operator y=(x==1)?1:0;
  // 1-  check the flow of the code
  //2- If ur stuck read the problem once again
  //3- before submitting always check the output format of ur code
  //4- don't check standings until problem B is done
  //5- if u r thinking ur concept is correct but still u r getting wrong answer try to implement it in another way
  //6- By default, java interpret all numeral literals as 32-bit integer values.
  // If you want to explicitely specify that this is something bigger then 32-bit integer you should use suffix L for long values.    example   long a = 600851475143L
  
  //All the functions
  
  
  
      static void debug(String s)
      { System.out.println(s);
  
      }
  
      //collections.sort use merge sort instead of quick sort but arrays.sort use quicksort whose worst time complexity is O(n^2)
      static int[] sort(int[] a)
      {         ArrayList<Integer> list = new ArrayList<>();
          for(int i=0;i<a.length;i++)
              list.add(a[i]);
  
          Collections.sort(list);
          int ind=0;
          for(int x:list)
              a[ind++]=x;
          return a;
  
      }
  
      //function to print an array for debugging
      static void print(int[] a) {
          for (int i = 0; i < a.length; i++)
              System.out.print(a[i] + " ");
          System.out.println();
      }
  
      static void printc(char[] a) {
          for (int i = 0; i < a.length; i++)
              System.out.print(a[i] + " ");
          System.out.println();
      }
  
  
      //normal gcd function, always put the greater number as a and the smaller number as b
      static int gcd(int a, int b) {
          if (b == 0)
              return a;
          return gcd(b, a % b);
  
      }
  
      static int lcm(int a,int b)
      {
          return (a*b)/gcd(a,b);
      }
  
  
      //to find gcd and lcm for numbers of long data type
      static long gcdl(long a, long b) {
          if (b == 0)
              return a;
          return gcdl(b, a % b);
  
      }
  
      static long lcml(long a,long b)
      {
          return (a*b)/gcdl(a,b);
      }
  
  
      //Input Reader to read faster input
      static class FastReader {
          BufferedReader br;
          StringTokenizer st;
  
          public FastReader() {
              br = new BufferedReader(new
                      InputStreamReader(System.in));
          }
  
          String next() {
              while (st == null || !st.hasMoreElements()) {
                  try {
                      st = new StringTokenizer(br.readLine());
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              }
              return st.nextToken();
          }
  
          int nextInt() {
              return Integer.parseInt(next());
          }
  
          long nextLong() {
              return Long.parseLong(next());
          }
  
          double nextDouble() {
              return Double.parseDouble(next());
          }
  
          String nextLine() {
              String str = "";
              try {
                  str = br.readLine();
              } catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }
  
  
          int[] readArray(int n)
          {  int[] a = new int[n];
              for(int i=0;i<n;i++)
                  a[i]=nextInt();
  
              return a;
          }
      }
  
  
  
  }
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  