#include <bits/stdc++.h>
using namespace std;
map<string, int> dict;
bool buf[16][16] = {};
vector<int> ans;
int main(void) {
  int n, m;
  cin >> n >> m;
  vector<string> name(n);
  for (int i = 0; i < (n); ++i) {
    string s;
    cin >> s;
    dict[s] = i;
    name[i] = s;
  }
  for (int i = 0; i < (m); ++i) {
    string _a, _b;
    cin >> _a >> _b;
    int a = dict[_a], b = dict[_b];
    buf[a][b] = buf[b][a] = true;
  }
  for (int c = 0; c < ((1 << n)); ++c) {
    vector<int> res;
    for (int i = 0; i < (n); ++i)
      if (c & (1 << i)) res.push_back(i);
    bool tag = true;
    for (int i = 0; i < (res.size()); ++i)
      for (int j = 0; j < (res.size()); ++j)
        if (buf[res[i]][res[j]]) tag = false;
    if (tag && res.size() > ans.size()) ans = res;
  }
  cout << ans.size() << endl;
  vector<string> pt(ans.size());
  for (int i = 0; i < (ans.size()); ++i) pt[i] = name[ans[i]];
  sort(pt.begin(), pt.end());
  for (int i = 0; i < (pt.size()); ++i) cout << pt[i] << endl;
  return 0;
}
