#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  map<string, int> names;
  string name_from_ind[n];
  for (int i = 0; i < n; i++) {
    string nm;
    cin >> nm;
    names[nm] = i;
    name_from_ind[i] = nm;
  }
  vector<pair<int, int> > pairs;
  for (int i = 0; i < m; i++) {
    string a, b;
    cin >> a >> b;
    pairs.push_back(pair<int, int>(names[a], names[b]));
  }
  int N = (1 << n);
  vector<string> ans;
  for (int i = 0; i < N; i++) {
    bool valid = true;
    for (int j = 0; j < m; j++) {
      int a = pairs[j].first;
      int b = pairs[j].second;
      if (((i & (1 << a)) != 0) && ((i & (1 << b)) != 0)) {
        valid = false;
        break;
      }
    }
    if (valid) {
      vector<string> team;
      int count = 0;
      for (int j = 0; j < n; j++)
        if ((i & (1 << j)) != 0) team.push_back(name_from_ind[j]);
      if (team.size() > ans.size()) ans = team;
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (vector<string>::iterator it = ans.begin(); it != ans.end(); it++)
    cout << *it << endl;
}
