#include <bits/stdc++.h>
using namespace std;
void lo_ol() {
  int n, m;
  cin >> n >> m;
  int mask = -1, len = 0;
  string names[n + 1];
  map<string, int> mp;
  for (int i = 0; i < n; i++) {
    cin >> names[i];
    mp[names[i]] = i;
  }
  pair<int, int> A[m];
  for (int i = 0; i < m; i++) {
    string a, b;
    cin >> a >> b;
    A[i] = {mp[a], mp[b]};
  }
  for (int i = 0; i < (1 << n); i++) {
    int bits = 0;
    for (auto j : A) {
      if ((i & (1 << j.first)) and (i & (1 << j.second))) goto end;
    }
    for (int j = 0; j < n; j++) {
      if (i & (1 << j)) bits++;
    }
    if (bits > len) {
      len = bits;
      mask = i;
    }
  end:;
  }
  set<string> s;
  for (int j = 0; j < n; j++) {
    if (mask & (1 << j)) s.insert(names[j]);
  }
  cout << s.size() << endl;
  for (const auto &i : s) cout << i << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int test = 1;
  while (test--) {
    lo_ol();
  }
}
