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: 
  //package com.company;
  
  
  
  import  java.math.*;
  import java.util.*;
  import java.lang.*;
  import java.io.*;
  
  
  
  public final class Main {
  
      FastReader s;
  
  
      public static void main (String[] args) throws java.lang.Exception
      {
  
          new Main().run();
  
      }
      void run()
      {
          s = new FastReader();
          solve();
      }
     StringBuffer sb;
     // int counter;
      void solve()
      {
           sb = new StringBuffer();
  
          for(int T = s.nextInt();T > 0;T--)
          {
  
  
              start();
  
  
          }
  
         // System.out.print(sb);
  
      }
  
  
      void start()
      {
  
          int n = s.nextInt();
  
           int mat[][] = new int[n][5];
          for(int i = 0; i<n; i++)
          {
              char [] x = s.nextLine().toCharArray();
              for(char c : x)
              {
                  mat[i][c-'a']++;
              }
              int p[] = new int[5];
              int to = 0;
              for(int j : mat[i])
                  to+=j;
  
              for(int j = 0; j<5; j++)
              {
                  mat[i][j]=2*mat[i][j]-to;
              }
          }
  
          int ans  = 0;
          for(int i = 0; i<5; i++)
          {
              int g = check(i,mat, n);
              ans = Math.max(g,ans);
          }
          System.out.println(ans);
  
  
  
      }
  
      int check(int i, int mat[][], int n)
      {
          ArrayList<Integer> x = new ArrayList<>();
          for(int j = 0; j<n; j++)
          {
              x.add(mat[j][i]);
          }
          Collections.sort(x);
          int s = 0;
          int cnt = 0;
          int l = n-1;
          while(l>=0)
          {
              int u = x.get(l);
              if(s+u>0)
              {
                  s+=u;
                  cnt++;
              }
              else
                  break;
              l--;
          }
          return cnt;
      }
  
  
  
  
      long gcd(long a, long b)
      {
          if (b == 0)
              return a;
          return gcd(b, a % b);
      }
      long power(long x, long y, long p)
      {
          long res = 1; // Initialize result
  
          // Update x if it is more
          // than or equal to p
          x = x % p;
  
          while (y > 0)
          {
              // If y is odd, multiply
              // x with the result
              if ((y & 1) > 0)
                  res = (res * x) % p;
  
              // y must be even now
              y = y >> 1; // y = y/2
              x = (x * x) % p;
          }
          return res;
      }
  
      int lower_bound(int [] arr , int key)
      {
  
          int i = 0;
          int j = arr.length-1;
            //if(arr[i] > key)return -1;
           if(arr[j] < key)return -1;
  
          while(i<j)
          {
              int mid = (i+j)/2;
  
              if(arr[mid] == key)
              {
                  j = mid;
              }
  
              else if(arr[mid] < key)
              {
                  i = mid+1;
              }
              else
                  j = mid-1;
        }
  
          return i;
      }
  
      int upper_bound(int [] arr , int key)
      {
  
          int i = 0;
          int j = arr.length-1;
          if(arr[j] <= key)return j+1;
  
          while(i<j)
          {
              int mid = (i+j)/2;
  
  
  
               if(arr[mid] <= key)
              {
                  i = mid+1;
              }
              else
                  j = mid;
          }
  
          return i;
      }
  
  
      static void sort(int[] A){
          int n = A.length;
          Random rnd = new Random();
          for(int i=0; i<n; ++i){
              int tmp = A[i];
              int randomPos = i + rnd.nextInt(n-i);
              A[i] = A[randomPos];
              A[randomPos] = tmp;
          }
          Arrays.sort(A);
      }
      static void sort(long[] A){
          int n = A.length;
          Random rnd = new Random();
          for(int i=0; i<n; ++i){
              long tmp = A[i];
              int randomPos = i + rnd.nextInt(n-i);
              A[i] = A[randomPos];
              A[randomPos] = tmp;
          }
          Arrays.sort(A);
      }
      static String sort(String s) {
          Character ch[]=new Character[s.length()];
          for(int i=0;i<s.length();i++) {
              ch[i]=s.charAt(i);
          }
          Arrays.sort(ch);
          StringBuffer st=new StringBuffer("");
          for(int i=0;i<s.length();i++) {
              st.append(ch[i]);
          }
          return st.toString();
      }
  
      //long array input
      public long [] longArr(int len)
      {
          // long arr input
          long [] arr = new long[len];
          String [] strs =  s.nextLine().trim().split("\\s+");
          for(int i =0; i<len; i++)
          {
              arr[i] = Long.parseLong(strs[i]);
  
          }
          return arr;
      }
      // int arr input
      public int [] intArr(int len)
      {
          // long arr input
          int [] arr = new int[len];
          String [] strs =  s.nextLine().trim().split("\\s+");
          for(int i =0; i<len; i++)
          {
              arr[i] = Integer.parseInt(strs[i]);
  
          }
          return arr;
      }
  
      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;
          }
      }
  
  
  
  }
  