#include <bits/stdc++.h>
using namespace std;
bool a[18][18];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) a[i][j] = 1;
  }
  map<string, int> mp;
  string name;
  vector<string> names(n);
  for (int i = 0; i < n; i++) {
    cin >> name;
    mp[name] = i;
    names[i] = name;
  }
  string s1, s2;
  for (int i = 0; i < m; i++) {
    cin >> s1 >> s2;
    a[mp[s1]][mp[s2]] = 0;
    a[mp[s2]][mp[s1]] = 0;
  }
  int res = 0;
  vector<int> v;
  vector<int> vres;
  for (int i = 1; i < (1 << n); i++) {
    v.clear();
    for (int j = 0; j < n; j++) {
      if ((1 << j) & i) {
        v.push_back(j);
      }
    }
    bool b = true;
    for (int j = 0; j < v.size(); j++) {
      for (int k = j + 1; k < v.size(); k++) {
        if (!a[v[j]][v[k]]) {
          b = false;
          break;
        }
      }
    }
    if (b) {
      if (v.size() > res) {
        res = v.size();
        vres = v;
      }
    }
  }
  cout << res << endl;
  vector<string> team;
  for (int i = 0; i < vres.size(); i++) {
    team.push_back(names[vres[i]]);
  }
  sort(team.begin(), team.end());
  for (int i = 0; i < team.size(); i++) {
    if (i != 0) cout << endl;
    cout << team[i];
  }
  cout << endl;
  return 0;
}
