#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long i, n, j, m;
  map<string, int> mp;
  cin >> n >> m;
  string s[n], v[m], u[m];
  for (i = 0; i < n; i++) {
    cin >> s[i];
  }
  for (i = 0; i < m; i++) cin >> v[i] >> u[i];
  sort(s, s + n);
  for (i = 0; i < n; i++) mp[s[i]] = i;
  int ans = 0;
  for (i = 0; i < (1 << n); i++) {
    bool f = 1;
    for (j = 0; j < m; j++)
      if ((i & (1 << mp[v[j]])) && (i & (1 << mp[u[j]]))) f = 0;
    if (f && __builtin_popcount(ans) < __builtin_popcount(i)) ans = i;
  }
  cout << __builtin_popcount(ans) << endl;
  for (i = 0; i < n; i++)
    if (ans & (1 << i)) cout << s[i] << endl;
  return 0;
}
