#include <bits/stdc++.h>
using namespace std;
const int N = 20;
int a[N][N], n, m, gh, mx = -1e9;
string s, aba, t, s1[N];
map<string, int> mp;
vector<string> ans;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> aba;
    mp[aba] = i;
    s1[i] = aba;
  }
  for (int i = 0; i < m; i++) {
    string hh;
    cin >> aba >> hh;
    a[mp[aba]][mp[hh]] = a[mp[hh]][mp[aba]] = 1;
  }
  for (int i = 0; i < (1 << n); i++) {
    bool ch = 0;
    int cnt = 0;
    for (int j = 0; j < n; j++)
      if ((i >> j) & 1) {
        for (int k = 0; k < n; k++)
          if ((i >> k) & 1) ch = ch | a[j][k];
        cnt++;
      }
    if (!ch && cnt > mx) gh = i, mx = cnt;
  }
  for (int i = 0; i < n; i++)
    if ((gh >> i) & 1) ans.push_back(s1[i]);
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << endl;
  return 0;
}
