#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(false), cin.tie(NULL), cout.tie(0);
  int a, b, mx = -1;
  cin >> a >> b;
  vector<int> ans(a + 1);
  map<string, int> m;
  map<int, string> pos;
  map<pair<int, int>, int> v;
  vector<string> vec;
  string s[a];
  for (long long int i = 0; i < a; i++) {
    cin >> s[i];
    m[s[i]] = i;
    pos[i] = s[i];
  }
  for (long long int i = 0; i < b; i++) {
    string s, t;
    cin >> s >> t;
    int x = m[s], y = m[t];
    v[{x, y}] = 1;
  }
  for (long long int i = 0; i < (1 << a); i++) {
    vector<int> c(a + 1);
    int ct = 0;
    for (long long int j = 0; j < a; j++) {
      if (i & (1 << j))
        c[j] = 1, ct++;
      else
        c[j] = 0;
    }
    int flag = 0;
    for (long long int j = 0; j < a; j++) {
      for (long long int k = 0; k < a; k++) {
        if (j == k)
          continue;
        else {
          if (c[j] == 1 and c[k] == 1 and v.count({j, k})) flag = 1;
        }
      }
    }
    if (!flag) {
      if (ct > mx) {
        mx = ct;
        ans = c;
      }
    }
  }
  cout << mx << '\n';
  for (long long int i = 0; i < a; i++) {
    if (ans[i] == 1) {
      vec.push_back(pos[i]);
    }
  }
  sort(vec.begin(), vec.end());
  for (long long int i = 0; i < vec.size(); i++) cout << vec[i] << '\n';
  return 0;
}
