Log Analysis
After the recent South Caucasus Championship, the coaches of the Tbilisi University team decided to analyze the number of attempts and the specific problems each team tackled during the post-competition Cup. They have a log detailing the sequence of submissions for each problem. In total, there are 26 distinct problems, each represented by a single Latin letter in the log.
The coaches aim to develop a program that counts the number of distinct groups of teams based on their "set of attempts" and determines the number of teams in each group. Teams are considered part of the same group if they made the same number of attempts for each problem.
Input
The first line of the input contains a single integer 1 ≤ N ≤ 10000, representing the number of teams. Following this, until the end of the file, there are N lines, each containing a word of lowercase Latin letters that describes the sequence of submissions for the problems. Identical letters indicate submissions for the same problem, while different letters indicate different problems. It is known that each team made no more than 15 submissions.
Output
The output should consist of several lines, each containing two numbers: the number of teams in a group and the number of groups of that size. These lines should be sorted in descending order based on the size of the groups.