#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 10;
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  long long n, q, max_size = 0;
  cin >> n >> q;
  string arr[n];
  vector<string> ans_v;
  for (int i = 0; i < n; ++i) cin >> arr[i];
  map<pair<string, string>, bool> mp;
  for (int i = 0; i < q; ++i) {
    string str1, str2;
    cin >> str1 >> str2;
    mp[make_pair(str1, str2)] = true;
  }
  for (int mask = 0; mask < (1 << n); ++mask) {
    vector<string> ans;
    for (int i = 0; i < n; ++i) {
      if (mask & (1 << i)) {
        ans.push_back(arr[i]);
      }
    }
    bool suit = true;
    for (int j = 0; j < ans.size(); ++j) {
      for (int k = 0; k < ans.size(); ++k) {
        if (mp[make_pair(ans[j], ans[k])] == true) {
          suit = false;
          break;
        }
      }
    }
    if (suit) {
      if (max_size < ans.size()) {
        max_size = ans.size();
        ans_v = ans;
      }
    }
  }
  cout << max_size << endl;
  sort(ans_v.begin(), ans_v.end());
  for (int i = 0; i < max_size; ++i) {
    cout << ans_v[i] << endl;
  }
  return 0;
}
