#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, m;
  cin >> n >> m;
  map<string, long long> id;
  map<long long, string> nam;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    id[s] = i;
    nam[i] = s;
  }
  long long a[n][n];
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) a[i][j] = 0;
  }
  for (int i = 0; i < m; i++) {
    string x, y;
    cin >> x >> y;
    a[id[x]][id[y]] = 1;
    a[id[y]][id[x]] = 1;
  }
  vector<long long> v, mx;
  for (long long i = 0; i < (1 << n); i++) {
    v.clear();
    bool is = 0;
    for (long long j = 0; j < n; j++) {
      if (i & (1 << j)) {
        for (long long k = 0; k < n; k++) {
          if ((i & (1 << k)) && a[j][k] == 1) is = 1;
        }
      }
    }
    if (is == 0) {
      for (long long j = 0; j < n; j++) {
        if (i & (1 << j)) v.push_back(j);
      }
      if (v.size() > mx.size()) mx = v;
    }
  }
  vector<string> ans;
  for (long long i = 0; i < mx.size(); i++) ans.push_back(nam[mx[i]]);
  sort(ans.begin(), ans.end());
  cout << ans.size() << '\n';
  for (long long i = 0; i < ans.size(); i++) cout << ans[i] << '\n';
  return 0;
}
