#include <bits/stdc++.h>
using namespace std;
bool ok(vector<string> &s, set<pair<string, string> > &st) {
  int n = s.size();
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++)
      if (st.find(make_pair(s[i], s[j])) != st.end()) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<string> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  set<pair<string, string> > st;
  for (int i = 0; i < m; i++) {
    string a, b;
    cin >> a >> b;
    st.insert(make_pair(a, b));
    st.insert(make_pair(b, a));
  }
  sort(v.begin(), v.end());
  int val = 0;
  vector<string> ret;
  for (int bt = 0; bt < (1 << n); bt++) {
    vector<string> cur;
    for (int i = 0; i < n; i++)
      if (bt & (1 << i)) cur.push_back(v[i]);
    if (ok(cur, st)) {
      int sz = cur.size();
      if (val < sz) {
        val = sz;
        ret = cur;
      }
    }
  }
  cout << val << endl;
  for (int i = 0; i < val; i++) cout << ret[i] << endl;
  return 0;
}
