"Powerpuff men" and "1234" were rewarded the prize of #1 & #2 3awatleyyeh groups in ASU; therefore they thought of opening an online non-existent company and call themselves CEOs of 3awatleyyeh Co.
3awatleyyeh Co. is a company with no tasks, they only spam LinkedIn with fake achievements and success stories posts plus calling themselves El 7eetan to advertise themselves. They decided to do another useless activity together since they have nothing to do in their lives.
The activity is as follows: they wanted to compare their family trees and check what is the maximum occurrences of similar family tree structures, with the oldest known ancestors they remember as the roots of the tree, at least going back to their four grandparents. Each node in the tree has a value, either M or F. M for a Male, F for a Female.
Each person (except the roots) has exactly two parents, and no two parents of the same child share a common ancestor. The family tree is represented as a directed acyclic graph (DAG), with edges directed from parent to child. Two family trees are considered identical if they have the same structure and the same labels at every corresponding node.
Since they are lazy brain-rotted individuals, they hired you to do this task for them.
The first line contains a single integer $$$n$$$ – the number of 3awatleyyeh $$$(1 \leq n \leq 10^4)$$$.
For each of the $$$n$$$ family trees:
It is guaranteed that:
Print a single integer – the maximum number of identical family trees among the $$$n$$$ given trees.
47M F M F M F M60 41 42 53 54 65 67M F M F M F M64 62 51 45 63 50 47M F M F M F M62 50 43 54 61 45 67F M F M F M F60 41 42 53 54 65 6
3
The first three family trees are structurally identical with matching labels – the edges are listed in a different order in the input for each, but the underlying structure is the same. The fourth tree has all labels swapped (F where M was and vice versa), making it different from the rest. Therefore the answer is $$$3$$$.