#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
using ll = long long;
int main() {
  int n, m;
  cin >> n >> m;
  map<int, string> names;
  map<string, int> id;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    names[i] = s;
    id[s] = i;
  }
  vector<pair<int, int>> dg;
  for (int i = 0; i < m; i++) {
    string a, b;
    cin >> a >> b;
    dg.emplace_back(id[a], id[b]);
  }
  int prospect = -1, con = 1e4;
  int base = pow(2, n) - 1;
  for (int i = 1; i <= base; i++) {
    int conflict = 0;
    for (auto it : dg) {
      int x = it.first, y = it.second;
      if ((1 & (i >> x)) && (1 & (i >> y))) {
        conflict++;
      }
    }
    if (conflict < con) {
      prospect = i;
      con = conflict;
    } else if (conflict == con) {
      int comp = __builtin_popcount(i);
      int comp2 = __builtin_popcount(prospect);
      if (comp > comp2) {
        prospect = i;
      }
    }
  }
  vector<string> ans;
  for (int i = 0; i < 32; i++) {
    if (1 & (prospect >> i)) {
      ans.push_back(names[i]);
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << "\n";
  for (auto it : ans) {
    cout << it << "\n";
  }
}
