#include <bits/stdc++.h>
using namespace std;
int n, _m, ans = 0;
map<string, int> m;
string s[1010], u[1010], v[1010];
int main() {
  cin >> n >> _m;
  for (int i = 1; i <= n; i++) cin >> s[i];
  sort(s + 1, s + n + 1);
  for (int i = 1; i <= n; i++) m[s[i]] = i - 1;
  for (int i = 1; i <= _m; i++) cin >> u[i] >> v[i];
  for (int i = 1; i <= (1 << n); i++) {
    bool flag = 1;
    for (int j = 1; j <= _m; j++)
      if (((i - 1) & (1 << m[u[j]])) && ((i - 1) & (1 << m[v[j]]))) flag = 0;
    if (flag && __builtin_popcount(ans) < __builtin_popcount(i - 1))
      ans = i - 1;
  }
  cout << __builtin_popcount(ans) << '\n';
  for (int i = 1; i <= n; i++)
    if (ans & (1 << (i - 1))) cout << s[i] << '\n';
  return 0;
}
