#include <bits/stdc++.h>
using namespace std;
int main() {
  int viss[20], xx[20][20], i, j, k, n, m, t, tt, f, x, ans, sum;
  string s[20], a, b;
  map<string, int> vis;
  vector<int> q;
  vector<string> ss;
  q.clear();
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> s[i];
    vis[s[i]] = i;
  }
  memset(xx, 0, sizeof(xx));
  for (i = 0; i < m; i++) {
    cin >> a >> b;
    xx[vis[a]][vis[b]] = 1;
    xx[vis[b]][vis[a]] = 1;
  }
  for (sum = ans = 0, i = 1; i < (1 << n); i++) {
    x = i;
    q.clear();
    for (j = 0; j < n; j++) {
      if ((x >> j) & 1) {
        q.push_back(j + 1);
      }
    }
    for (f = j = 0; j < q.size(); j++) {
      for (k = j + 1; k < q.size(); k++) {
        if (xx[q[j]][q[k]]) {
          f = 1;
          break;
        }
      }
      if (f) break;
    }
    if (f == 0 && ans < q.size()) {
      ans = q.size();
      sum = i;
    }
  }
  q.clear();
  for (i = 0; i < n; i++) {
    if ((sum >> i) & 1) {
      ss.push_back(s[i + 1]);
    }
  }
  cout << ss.size() << endl;
  sort(ss.begin(), ss.end());
  for (i = 0; i < ss.size(); i++) {
    cout << ss[i] << endl;
  }
  return 0;
}
