#include <bits/stdc++.h>
using namespace std;
char xx;
static bool comp(string &a, string &b) {
  long long l = 0;
  long long r = 0;
  for (auto x : a) {
    if (x == xx) l++;
  }
  for (auto x : b) {
    if (x == xx) r++;
  }
  return (2 * l - a.size()) > (2 * r - b.size());
}
void solve() {
  long long n;
  cin >> n;
  vector<string> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  for (long long id = 0; id < 5; id++) {
    xx = 'a' + id;
    sort(a.begin(), a.end(), comp);
    long long tans = -1;
    bool f = 0;
    long long cur = 0, tot = 0;
    for (long long i = 0; i < n; i++) {
      for (auto x : a[i]) {
        if (x == xx) cur++;
      }
      tot += (long long)(a[i].size());
      if (tot - cur >= cur) {
        f = 1;
        tans = i;
        break;
      }
    }
    if (!f) tans = n;
    ans = max(ans, tans);
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
