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

NEERC 2010, Eastern subregional contest

About     Problems     Submit solution     Judge status     Standings
Contest is over

B. The Revolution Cup

Time limit: 0.5 second
Memory limit: 64 MB
At the first stage of the Revolution Football Cup, all the teams are divided into groups and play according to the all-play-all system. The organizers of the tournament ask you to help them form the groups.
The teams should be divided into g groups, t teams in each group. The teams have been distributed to t pots, g teams in each pot. In the first pot there are the strongest teams, in the second pot there are teams that are a bit less stronger, and so on. In the last pot there are the weakest teams. It is required to form groups so that there would be exactly one team from each pot in each group. The organizers also want all t teams in each group to represent different political parties.

Input

The first line contains the integers g and t separated with a space (1 ≤ g, t ≤ 100). The following lines describe the pots. Each line contains the name of a team and the name of the party it represents. These names are separated with a space. The descriptions of pots are separated with an empty line. The names of teams and parties consist of lowercase English letters, and their lengths are in the range from 1 to 10. The names of all teams are different.

Output

If it is impossible to divide the teams into groups as required, output one line containing the word “No”. Otherwise, output “Yes” and then the description of g groups. Each group is described by the names of t teams that are in this group, each name in a separate line. The description of each group should be preceded by an empty line. If there are several answers, output any of them.

Samples

inputoutput
2 3
cavalry red
guard white

infantry red
guerilla green

czechs white
gunners latvia
Yes

cavalry
guerilla
czechs

guard
infantry
gunners
2 2
cavalry red
guard white

czechs white
cossacks white
No
Problem Author: Magaz Asanov
Problem Source: NEERC 2010, Eastern subregional contest
To submit the solution for this problem go to the Problem set: 1801. The Revolution Cup