#include <bits/stdc++.h>
using namespace std;
int n, m, res = 0;
map<string, int> mp;
map<int, string> inv;
vector<string> ans;
bool graph[16][16];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    mp[s] = i;
    inv[i] = s;
  }
  memset(graph, false, sizeof(bool) * 16 * 16);
  for (int i = 0; i < m; i++) {
    string x, y;
    cin >> x >> y;
    graph[mp[x]][mp[y]] = graph[mp[y]][mp[x]] = true;
  }
  for (int i = 0; i < (1 << n); i++) {
    bool ok = true;
    for (int j = 0; j < n; j++)
      for (int k = j + 1; k < n; k++)
        if ((1 & (i >> j)) && (1 & (i >> k)))
          if (graph[j][k]) ok = false;
    if (ok) {
      int cnt = 0;
      vector<string> tmp;
      for (int j = 0; j < n; j++)
        if (1 & (i >> j)) {
          ++cnt;
          tmp.push_back(inv[j]);
        }
      if (cnt > res) {
        res = cnt;
        ans = tmp;
      }
    }
  }
  sort(ans.begin(), ans.end());
  cout << res << endl;
  for (int i = 0; i < res; i++) cout << ans[i] << endl;
  return 0;
}
