시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB16113111481.429%

문제

You're given a five-card hand drawn from a standard 52-card deck. Each card has a rank (one of A, 2, 3, . . . , 9, T, J, Q, K), and a suit (one of C, D, H, S).The strength of your hand is defined as the maximum value k such that there are k cards in your hand that have the same rank.

Find the strength of your hand.

입력

The first line of input will contain a single integer n that indicates the number datasets to follow. Each dataset will consist a single line, with five two-character strings separated by spaces. The first character in each string will be the rank of the card, and will be one of A23456789TJQK. The second character in the string will be the suit of the card, and will be one of CDHS. It is guaranteed that all five strings are distinct.

출력

For each dataset output, on a single line, the strength of your hand.

예제 입력 1

2
AC AD AH AS KD
2C 4D 4H 2D 2H

예제 출력 1

4
3