#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n, m;
  cin >> n >> m;
  vector<string> names(n);
  for (auto& name : names) cin >> name;
  map<pair<string, string>, bool> edges;
  while (m--) {
    string a, b;
    cin >> a >> b;
    edges[{a, b}] = true;
    edges[{b, a}] = true;
  }
  vector<string> answers;
  for (int i = 0; i < (1 << n); ++i) {
    if (__builtin_popcount(i) < answers.size()) continue;
    vector<string> current;
    for (int j = 0; j < n; ++j)
      if (i & (1 << j)) current.push_back(names[j]);
    bool works = true;
    for (int j = 0; j < current.size(); ++j)
      for (int k = j + 1; k < current.size(); ++k)
        if (edges.count({current[j], current[k]})) works = false;
    if (works) answers = current;
  }
  sort(answers.begin(), answers.end());
  cout << answers.size() << '\n';
  for (auto& answer : answers) cout << answer << '\n';
}
