#include <bits/stdc++.h>
using namespace std;
int n, m;
map<string, int> mp;
bool a[20][20];
int res;
int cntt(int p) {
  int r = 0;
  while (p > 0) {
    if (p % 2 == 1) r++;
    p /= 2;
  }
  return r;
}
int main() {
  cin >> n >> m;
  string s, x;
  memset(a, true, sizeof a);
  for (int i = 0; i < n; i++) {
    cin >> s;
    mp.insert(make_pair(s, i));
  }
  for (int i = 0; i < m; i++) {
    cin >> s >> x;
    a[mp[s]][mp[x]] = false;
    a[mp[x]][mp[s]] = false;
  }
  res = 0;
  for (int i = 0; i < (1 << n); i++) {
    bool ck = true;
    for (int j = 0; j < n; j++)
      if (((i >> j) & 1) == 1)
        for (int p = 0; p < n; p++)
          if (((i >> p) & 1) == 1) {
            if (!a[j][p]) {
              ck = false;
              break;
            }
          }
    if (ck && cntt(res) < cntt(i)) res = i;
  }
  int cntt = 0;
  for (int i = 0; i < n; i++)
    if (((res >> i) & 1) == 1) cntt++;
  cout << cntt << endl;
  for (map<string, int>::iterator it = mp.begin(); it != mp.end(); it++) {
    int j = it->second;
    if (((res >> j) & 1) == 1) {
      cout << (it->first) << endl;
    }
  }
  return 0;
}
