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".
/**
 * @Created_by : Lucent868
 * @Date : 26-08-2021
 * @Time :  09:32
 */

import java.util.*;
import java.io.*;
import java.math.*;

public class I {
    static InputReader in;
    static PrintWriter out;

    public static void main(String args[]) {
        new Thread(null, new Runnable() {
            public void run() {
                try {
                    solve();
                    out.flush();
                    out.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }, "1", 1 << 26).start();
    }

    public static void solve() {
        in = new InputReader(System.in);
        out = new PrintWriter(System.out);

        int t = in.nextInt();
        while (t-- > 0) {
            int n = in.nextInt();
            String s[] = new String[n];

            int f[][] = new int[n][5];
            for (int i = 0; i < n; i++) {
                s[i]  = in.readString();
                for (int j = 0; j < s[i].length(); j++) {
                    f[i][s[i].charAt(j  )-'a']++;
                }
            }

            int ans = 0;
            for ( int i = 0; i < 5; i++) {
                final  int ii = i;
                Arrays.sort(f, new Comparator<int[]>() {
                    @Override
                    public int compare(int[] o1, int[] o2) {
                        if(o1[ii] < o2[ii])
                            return 1;
                        else if(o1[ii] > o2[ii])
                            return -1;
                        else
                        {
                            int s1 = o1[0]+o1[1]+o1[2]+o1[3]+o1[4] - o1[ii];
                            int s2 = o2[0]+o2[1]+o2[2]+o2[3]+o2[4] - o2[ii];
                            return Integer.compare(s1,s2);
                        }
                    }
                });


//                for (int j = 0; j < n; j++) {
//                    for (int k = 0; k < 5; k++) {
//                        out.print(f[j][k]+" ");
//                    }
//                    out.println();
//                }


                int max = 0;
                int other=0;
                int cur = 0;
                for (int j = 0; j < n; j++) {
                    int o = 0;
                    for (int k = 0; k < 5; k++) {
                        if(k != i)
                            o+=f[j][k];
                    }

//                    out.println(o+other+" "+(cur+f[j][i]));
                    if(o+other<cur+f[j][i])
                    {
                        other+=o;
                        cur+=f[j][i];
                        max++;
                    }
                }

                ans = Math.max(ans,max);
//                out.println(max);
            }

            out.println(ans);

        }
    }

    static class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        public long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    public static int[] sort(int[] arr) {
        List<Integer> temp = new ArrayList();
        for (int i : arr) temp.add(i);
        Collections.sort(temp);
        int start = 0;
        for (int i : temp) arr[start++] = i;
        return arr;
    }

    public static long[] sort(long[] arr) {
        List<Long> temp = new ArrayList();
        for (long i : arr) temp.add(i);
        Collections.sort(temp);
        int start = 0;
        for (long i : temp) arr[start++] = i;
        return arr;
    }

    public static int bs(int[] a, int fromIndex, int toIndex,
                         double key) {
        int low = fromIndex;
        int high = toIndex - 1;

        while (low <= high) {
            int mid = (low + high) >>> 1;
            long midVal = a[mid];

            if (midVal < key)
                low = mid + 1;
            else if (midVal > key)
                high = mid - 1;
            else
                return mid; // key found
        }
        return -(low + 1);  // key not found.
    }

}
