#include <bits/stdc++.h>
using namespace std;
int main() {
  set<string> ans, cek;
  map<string, int> mp;
  vector<string> daftar;
  int n, m;
  int i, j, k, l;
  int ok = 1, mx = -1;
  string in, in1, in2;
  vector<pair<int, int> > dt;
  scanf("%d %d", &n, &m);
  daftar.resize(n);
  int id = n - 1;
  for (i = n - 1; i >= 0; i--) {
    cin >> in;
    mp[in] = i;
    daftar[i] = in;
  }
  if (m == 0) {
    printf("%d\n", n);
    for (map<string, int>::const_iterator it = mp.begin(); it != mp.end(); ++it)
      cout << it->first << endl;
    return 0;
  }
  for (i = 0; i < m; i++) {
    cin >> in1 >> in2;
    dt.push_back(make_pair(mp[in1], mp[in2]));
  }
  int bts = (int)(dt).size();
  for (i = (1 << n) - 1; i >= 0; i--) {
    bitset<16> bb(i);
    ok = 1;
    for (j = 0; j < bts; j++) {
      if (bb[dt[j].first] && bb[dt[j].second]) {
        ok = 0;
        break;
      }
    }
    if (ok) {
      cek.clear();
      for (k = 0; k < (int)(bb).size(); k++) {
        if (bb[k]) {
          cek.insert(daftar[k]);
        }
      }
      if ((int)(cek).size() > mx) {
        mx = (int)(cek).size();
        ans = cek;
      }
    }
  }
  printf("%d\n", (int)(ans).size());
  for (set<string>::const_iterator it = ans.begin(); it != ans.end(); ++it)
    cout << *it << endl;
  return 0;
}
