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 java.util.*;
import java.io.*;

public class Solution
{
    private static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        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;
        }
    }

    private static Scanner sc = new Scanner(System.in);
    private static PrintWriter out = new PrintWriter(System.out);
    private static FastReader in = new FastReader();
    private static final int M = 1000000007;

    private static class Container
    {
        int freq_a;
        int freq_b;
        int freq_c;
        int freq_d;
        int freq_e;
        int tot_freq;

        Container(int a, int b ,int c, int d, int e)
        {
            freq_a = a;
            freq_b = b;
            freq_c = c;
            freq_d = d;
            freq_e = e;
            tot_freq = a + b + c + d + e;
        }
        boolean maj_a()
        {
            return tot_freq == 0 || freq_a > (tot_freq / 2);
        }
        boolean maj_b()
        {
            return tot_freq == 0 || freq_b > (tot_freq / 2);
        }
        boolean maj_c()
        {
            return tot_freq == 0 || freq_c > (tot_freq / 2);
        }
        boolean maj_d()
        {
            return tot_freq == 0 || freq_d > (tot_freq / 2);
        }
        boolean maj_e()
        {
            return tot_freq == 0 || freq_e > (tot_freq / 2);
        }
        void merge(Container other)
        {
            freq_a += other.freq_a;
            freq_b += other.freq_b;
            freq_c += other.freq_c;
            freq_d += other.freq_d;
            freq_e += other.freq_e;
            tot_freq += other.tot_freq;
        }
        void print()
        {
            out.println("a = " + freq_a + " b = " + freq_b + " c = " + freq_c + " d = " + freq_d + " e = " + freq_e + " tot = " + tot_freq);
        }
    }

    private static class a_Compare implements Comparator<Container>
    {
        public int compare(Container c1, Container c2)
        {
            int score1 = 2 * c1.freq_a - c1.tot_freq;
            int score2 = 2 * c2.freq_a - c2.tot_freq;
            return score2 - score1;
        }
    }
    private static class b_Compare implements Comparator<Container>
    {
        public int compare(Container c1, Container c2)
        {
            int score1 = 2 * c1.freq_b - c1.tot_freq;
            int score2 = 2 * c2.freq_b - c2.tot_freq;
            return score2 - score1;
        }
    }
    private static class c_Compare implements Comparator<Container>
    {
        public int compare(Container c1, Container c2)
        {
            int score1 = 2 * c1.freq_c - c1.tot_freq;
            int score2 = 2 * c2.freq_c - c2.tot_freq;
            return score2 - score1;
        }
    }
    private static class d_Compare implements Comparator<Container>
    {
        public int compare(Container c1, Container c2)
        {
            int score1 = 2 * c1.freq_d - c1.tot_freq;
            int score2 = 2 * c2.freq_d - c2.tot_freq;
            return score2 - score1;
        }
    }
    private static class e_Compare implements Comparator<Container>
    {
        public int compare(Container c1, Container c2)
        {
            int score1 = 2 * c1.freq_e - c1.tot_freq;
            int score2 = 2 * c2.freq_e - c2.tot_freq;
            return score2 - score1;
        }
    }

    public static void main(String[] args)
    {
        int t = in.nextInt();

        for(int z = 0; z < t; z ++)
        {
            int n = in.nextInt();
            List<Container> list = new ArrayList<>();
            for(int i = 0; i < n; i++)
            {
                String s = in.next();
                int a = 0;
                int b = 0;
                int c = 0;
                int d = 0;
                int e = 0;
                for(int j = 0; j < s.length(); j++)
                {
                    char character = s.charAt(j);
                    if(character == 'a')  a ++;
                    if(character == 'b')  b ++;
                    if(character == 'c')  c ++;
                    if(character == 'd')  d ++;
                    if(character == 'e')  e ++;
                }
                list.add(new Container(a, b, c, d, e));
            }
            //out.println("size of list : " + list.size());
            int res = 0;

            //checking for a
            //out.println("checking for a");
            Collections.sort(list, new a_Compare());
            //out.print("sorted list : ");
            //for(Container c : list) c.print();
            //out.println("done");
            int count = 0;
            Container cont = new Container(0, 0, 0, 0, 0);
            Iterator<Container> it = list.iterator();

            while(it.hasNext())
            {
                cont.merge(it.next());
                if(cont.maj_a())    count ++;
                else    break;
                //cont.print();
            }

            res = Math.max(res, count);

            //checking for b
            //out.println("checking for b");
            Collections.sort(list, new b_Compare());
            //out.print("sorted list : ");
            //for(Container c : list) c.print();
            count = 0;
            cont = new Container(0, 0, 0, 0, 0);
            it = list.iterator();

            while(it.hasNext())
            {
                cont.merge(it.next());
                if(cont.maj_b())    count ++;
                else    break;
                //cont.print();
            }

            res = Math.max(res, count);

            //checking for c
            //out.println("checking for c");
            Collections.sort(list, new c_Compare());
            //out.print("sorted list : ");
            //for(Container c : list) c.print();
            count = 0;
            cont = new Container(0, 0, 0, 0, 0);
            it = list.iterator();

            while(it.hasNext())
            {
                cont.merge(it.next());
                if(cont.maj_c())    count ++;
                else    break;
                //cont.print();
            }

            res = Math.max(res, count);

            //checking for d
            //out.println("checking for d");
            Collections.sort(list, new d_Compare());
            //out.print("sorted list : ");
            //for(Container c : list) c.print();
            count = 0;
            cont = new Container(0, 0, 0, 0, 0);
            it = list.iterator();

            while(it.hasNext())
            {
                cont.merge(it.next());
                if(cont.maj_d())    count ++;
                else    break;
                //cont.print();
            }

            res = Math.max(res, count);

            //checking for e
            //out.println("checking for e");
            Collections.sort(list, new e_Compare());
            //out.print("sorted list : ");
            //for(Container c : list) c.print();
            count = 0;
            cont = new Container(0, 0, 0, 0, 0);
            it = list.iterator();

            while(it.hasNext())
            {
                cont.merge(it.next());
                if(cont.maj_e())    count ++;
                else    break;
                //cont.print();
            }

            res = Math.max(res, count);

            //done
            out.println(res);
        }

        out.flush();
        out.close();
    }
}