#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> name(n);
  map<string, int> mm;
  for (int i = 0; i < n; i++) {
    cin >> name[i];
    mm[name[i]] = i;
  }
  vector<vector<int> > ng(n, vector<int>(n, 0));
  for (int i = 0; i < m; i++) {
    string s1, s2;
    cin >> s1 >> s2;
    ng[mm[s1]][mm[s2]] = 1;
    ng[mm[s2]][mm[s1]] = 1;
  }
  vector<string> ans;
  for (int x = (1 << n) - 1; x >= 0; x--) {
    vector<int> v;
    for (int i = 0; i < n; i++) {
      if (x & (1 << i)) v.push_back(i);
    }
    bool ok = true;
    for (size_t i = 0; ok && i < v.size(); i++) {
      for (size_t j = i + 1; ok && j < v.size(); j++) {
        if (ng[v[i]][v[j]]) {
          ok = false;
        }
      }
    }
    if (ok && ans.size() < v.size()) {
      ans.clear();
      for (size_t i = 0; i < v.size(); i++) {
        ans.push_back(name[v[i]]);
      }
      sort(ans.begin(), ans.end());
    }
  }
  cout << ans.size() << endl;
  for (size_t i = 0; i < ans.size(); i++) {
    cout << ans[i] << endl;
  }
  return 0;
}
