#include <bits/stdc++.h>
using namespace std;
map<string, vector<string> > graph;
unsigned long long int countSetBits(long long int n) {
  unsigned long long int count = 0;
  while (n) {
    n &= (n - 1);
    count++;
  }
  return count;
}
bool valid(set<string>& t) {
  for (auto i = t.begin(); i != t.end(); i++) {
    for (auto k : graph[*i]) {
      if (t.find(k) != t.end()) {
        return false;
      }
    }
  }
  return true;
}
void solve() {
  long long int n, m;
  cin >> n >> m;
  vector<string> players(n);
  for (long long int i = 0; i < n; i++) {
    cin >> players[i];
  }
  for (long long int i = 0; i < m; i++) {
    string a, b;
    cin >> a >> b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  set<string> ans;
  for (long long int i = 1; i < (1 << (n + 1)); i++) {
    set<string> tmp;
    for (long long int j = 0; j <= log2(i); j++) {
      if (i & (1 << j)) {
        tmp.insert(players[min(n - 1, j)]);
      }
    }
    if (ans.size() < tmp.size() && valid(tmp)) {
      ans = tmp;
    }
    tmp.clear();
  }
  cout << ans.size() << '\n';
  for (string s : ans) {
    cout << s << "\n";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int T = 1;
  while (T--) {
    solve();
    cout << endl;
  }
  return 0;
}
