PFAST Inc.

题意翻译

## **题目描述** 有n个人要参加比赛。但是,其中有一些人有敌对关系。有敌对关系的两个人不能同时参加比赛。现在你想让最多的人参加比赛。输出能参赛的人的名字。 ## 输入 第一行有两个整数n,m。n是参加比赛的人数(1<=n<=16)。m是有敌对关系的人的对数。 (0<=m<=n*(n-1)/2)。接下来的n行每行一个字符串,代表每一个参赛者的名字。每一个字符串的长度均不大于10且每一个字符串只包含大小写英文字母。接下来的m行每行两个名字,用空格隔开,代表有敌对关系的人。 ## 输出 第一行一个整数k,代表最多的参赛人数。接下来的k行每行一个人名,代表参赛者的名字,输出的名字按字典序排列。如果有多组解,任意输出一种。

题目描述

When little Petya grew up and entered the university, he started to take part in АСМ contests. Later he realized that he doesn't like how the АСМ contests are organised: the team could only have three members (and he couldn't take all his friends to the competitions and distribute the tasks between the team members efficiently), so he decided to organize his own contests PFAST Inc. — Petr and Friends Are Solving Tasks Corporation. PFAST Inc. rules allow a team to have unlimited number of members. To make this format of contests popular he organised his own tournament. To create the team he will prepare for the contest organised by the PFAST Inc. rules, he chose several volunteers (up to 16 people) and decided to compile a team from them. Petya understands perfectly that if a team has two people that don't get on well, then the team will perform poorly. Put together a team with as many players as possible given that all players should get on well with each other.

输入输出格式

输入格式


The first line contains two integer numbers $ n $ ( $ 1<=n<=16 $ ) — the number of volunteers, and $ m $ (![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF114B/311dfc9367ec4774f6a0336927e0070aebdbe68d.png)) — the number of pairs that do not get on. Next $ n $ lines contain the volunteers' names (each name is a non-empty string consisting of no more than 10 uppercase and/or lowercase Latin letters). Next $ m $ lines contain two names — the names of the volunteers who do not get on. The names in pair are separated with a single space. Each pair of volunteers who do not get on occurs exactly once. The strings are case-sensitive. All $ n $ names are distinct.

输出格式


The first output line should contain the single number $ k $ — the number of people in the sought team. Next $ k $ lines should contain the names of the sought team's participants in the lexicographical order. If there are several variants to solve the problem, print any of them. Petya might not be a member of the sought team.

输入输出样例

输入样例 #1

3 1
Petya
Vasya
Masha
Petya Vasya

输出样例 #1

2
Masha
Petya

输入样例 #2

3 0
Pasha
Lesha
Vanya

输出样例 #2

3
Lesha
Pasha
Vanya