#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int n, m;
  cin >> n >> m;
  map<string, int> mp;
  vector<string> st;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    st.push_back(s);
    mp[s] = i;
  }
  bool problem[n][n];
  memset(problem, false, sizeof problem);
  for (int i = 0; i < m; i++) {
    string a, b;
    cin >> a >> b;
    problem[mp[a]][mp[b]] = problem[mp[b]][mp[a]] = true;
  }
  int mx = 0;
  vector<vector<int> > v;
  for (int i = 0; i < (1 << n); i++) {
    int x = i, j = 0;
    vector<int> team;
    while (x) {
      if (x & 1) team.push_back(j);
      j++;
      x /= 2;
    }
    bool flag = false;
    for (int j = 0; j < team.size(); j++) {
      for (int k = j + 1; k < team.size(); k++) {
        flag |= problem[team[j]][team[k]];
      }
    }
    if (!flag) {
      mx = max(mx, (int)team.size());
      v.push_back(team);
    }
  }
  cout << mx << "\n";
  for (int i = 0; i < v.size(); i++) {
    if ((int)v[i].size() == mx) {
      vector<string> ans;
      for (int j = 0; j < v[i].size(); j++) ans.push_back(st[v[i][j]]);
      sort(ans.begin(), ans.end());
      for (int j = 0; j < ans.size(); j++) cout << ans[j] << "\n";
      break;
    }
  }
}
