#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const int inf = (int)1e9;
map<string, int> mm;
const int maxn = 110;
int a[maxn][maxn];
int bc[maxn * maxn * 10];
string ss[maxn];
int main() {
  int n, m;
  cin >> n >> m;
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    ss[i] = s;
    mm[s] = i;
  }
  string s1, s2;
  for (int i = 0; i < m; i++) {
    cin >> s1 >> s2;
    a[mm[s1]][mm[s2]] = 1;
    a[mm[s2]][mm[s1]] = 1;
  }
  for (int i = 1; i < (1 << n); i++) bc[i] = bc[i >> 1] + (i & 1);
  int res = 0, resm = 0;
  for (int i = 1; i < (1 << n); i++) {
    vector<int> v;
    for (int j = 0; j < n; j++)
      if ((i >> j) & 1) v.push_back(j);
    int good = 1;
    for (int i1 = 0; i1 < ((int)(v).size()) && good; i1++)
      for (int i2 = 0; i2 < ((int)(v).size()) && good; i2++)
        if (a[v[i1]][v[i2]]) good = 0;
    if (good && bc[i] > res) res = bc[i], resm = i;
  }
  cout << res << endl;
  vector<string> vs;
  for (int i = 0; i < n; i++)
    if ((resm >> i) & 1) vs.push_back(ss[i]);
  sort(vs.begin(), vs.end());
  for (int i = 0; i < ((int)(vs).size()); i++) cout << vs[i] << endl;
  return 0;
}
