#include <bits/stdc++.h>
using namespace std;
int n, m, never[17], ans;
string name[16];
vector<int> notgood[17];
int count(int i) {
  int res = 0;
  while (i) {
    res += i & 1;
    i >>= 1;
  }
  return res;
}
int main() {
  unordered_map<string, int> con;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) cin >> name[i], con[name[i]] = i;
  for (string a, b; m--;) {
    cin >> a >> b;
    int i = con[a], j = con[b];
    notgood[i].push_back(j);
    notgood[j].push_back(i);
  }
  for (int i = 0, ok; i < (1 << n); ++i) {
    for (int j = 0; j < n; ++j)
      if (i & (1 << j))
        for (int &k : notgood[j]) never[k] = i + 1;
    ok = true;
    for (int j = 0; j < n and ok; ++j)
      if ((i & (1 << j)) and never[j] == i + 1) ok = false;
    if (ok and count(i) > count(ans)) ans = i;
  }
  m = count(ans);
  cout << m << '\n';
  for (int j = 0, k = 0; j < n; ++j)
    if (ans & (1 << j)) name[k++] = name[j];
  sort(name, name + m);
  for (int i = 0; i < m; ++i) cout << name[i] << '\n';
}
