#include <bits/stdc++.h>
using namespace std;
template <class TT>
TT abs(TT a) {
  if (a < 0) return -a;
  return a;
}
template <class ZZ>
ZZ max(ZZ a, ZZ b, ZZ c) {
  return max(a, max(b, c));
}
template <class ZZ>
ZZ min(ZZ a, ZZ b, ZZ c) {
  return min(a, min(b, c));
}
map<string, int> mp;
map<int, string> imp;
bool mt[20][20];
vector<string> v;
int main() {
  int i, j, k, tks, ks = 1, n, m, l;
  string ss, s;
  while (cin >> n >> m) {
    memset(mt, false, sizeof(mt));
    mp.clear();
    imp.clear();
    k = 0;
    for (i = 0; i < n; i++) {
      cin >> s;
      imp[k] = s;
      mp[s] = k++;
    }
    while (m--) {
      cin >> s >> ss;
      mt[mp[s]][mp[ss]] = true;
      mt[mp[ss]][mp[s]] = true;
    }
    int kk = 0;
    for (i = 1; i < (1LL << n); i++) {
      l = 1;
      for (j = 0; j < n; j++)
        if (l)
          for (k = 0; k < n; k++)
            if ((i & (1LL << j)) && (i & (1LL << k)) && mt[j][k]) {
              l = 0;
              break;
            }
      if (!l) continue;
      m = (__builtin_popcount(i));
      if (m > kk) {
        kk = m;
        v.clear();
        for (j = 0; j < n; j++)
          if ((i & (1LL << j))) v.push_back(imp[j]);
      }
    }
    cout << kk << endl;
    sort((v).begin(), (v).end());
    for (i = 0; i < ((int)v.size()); i++) cout << v[i] << endl;
  }
  return 0;
}
