New Team Cypher (MEDIUM)

5

1 votes
Medium
Problem

This will the last contest organised by the Cypher's senior Team. So they want to make a new team which is capable of framing good questions. Now they know from experience that good team can only be created if all the team members are friends with each other and all of them are from the same section.
That is why they picked Top N students from the best section of LPU and interviewed each one of them and asked them about the persons they were friends with.
Now akgarhwal compiled the answer of all the candidate's and made a list such that each item in this contains two students A and B who are not friends with each other. The list will contain K such pairs.
Now your task is to create a team which have the maximum number of members such that all the team members are friends. Since there can be multiple answers for the same problem you have to print the name which comes first Lexicographically.

INPUT FORMAT:

  • The first line of input contains two integer N and K, denoting the number of students and number of lines in the list, respectively.
  • Each of next N lines contains a string describing the name of ith student of the section.
  • Next, K Lines will contain two string A and B,the students who are not friends with each other.

OUTPUT FORMAT:

  • The first line will contain an integer denoting the Numbers of students in the desired team.
  • Print the name of the selected member of the team in lexicographical order separated by white space.

Constraint:
1<= N <= 16
1<=|name|<=50
0<= K <= (N(N+1))/2*

Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

None

Editor Image

?