#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  string s[n];
  map<string, int> mp;
  map<int, string> rvmp;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    mp[s[i]] = i;
    rvmp[i] = s[i];
  }
  map<pair<string, string>, int> t;
  for (int i = 0; i < m; i++) {
    string aa, bb;
    cin >> aa >> bb;
    t[{aa, bb}] = 1;
    t[{bb, aa}] = 1;
  }
  vector<string> ans, temp1;
  int temp = 0;
  for (long int i = 1; i <= pow(2, n); i++) {
    int cnt = 0, j = i;
    while (j > 0) {
      if (j % 2 == 1) {
        temp1.push_back(rvmp[cnt]);
      }
      cnt++;
      j /= 2;
    }
    cnt = temp1.size();
    bool pp = 0;
    for (long int ij = 0; ij < cnt; ij++) {
      for (long int k = ij + 1; k < cnt; k++) {
        if (t[{temp1[ij], temp1[k]}]) pp = 1;
      }
    }
    if (pp == 0) {
      if (cnt > temp) {
        temp = cnt;
        ans.clear();
        for (long int k = 0; k < cnt; k++) {
          ans.push_back(temp1[k]);
        }
      }
    }
    temp1.clear();
  }
  cout << ans.size() << endl;
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << endl;
  }
}
