ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

USU Internal Contest March'2002

About     Problems     Submit solution     Judge status     Standings
Contest is over

I. Legendary Teams Contest

Time limit: 0.5 second
Memory limit: 64 MB
Nothing makes as old as years. A lot of cool contests are gone, a lot of programmers are not students anymore and are not allowed to take part at the contests. Though their spirit is fresh and young as it was years ago! And so once they decided to make a contest at the Ural State University among the veteran teams…
To make the contest interesting, they decided to invite as much "legendary" teams as possible. The jury has made a short list of teams, which have shown the best results in the old good times, thus being worthy to hold the name of "legendary". All those teams were invited to take part of the contest, and all of them accepted the invitations. But they have forgotten one important thing at the jury: during the long history of the contests at the university, the teams happened to change and some programmers managed to contest in different "legendary" teams. Though, the jury decided not to give up the initial idea and to form as much legendary teams as possible to participate at the contest — and your program should help the jury!


The first line contains a positive integer K, 1 ≤ K ≤ 18. It is the number of all the legendary teams. There follow the descriptions of the teams in K lines. Each of those lines contains three different names of the team members of the respective team. All names are written with not more than 20 small Latin letters.


You should output the maximal possible number of legendary teams of veterans, that could simultaneously participate at the contest.


gerostratos scorpio shamgshamg
zaitsev silverberg cousteau
zaitsev petersen shamgshamg
clipper petersen shamgshamg
clipper bakirelli vasiliadi
silverberg atn dolly
knuth dijkstra bellman
Problem Author: Leonid Volkov
Problem Source: USU Internal Contest, March 2002
To submit the solution for this problem go to the Problem set: 1208. Legendary Teams Contest