#include <bits/stdc++.h>
using namespace std;
long long a[100010], mx, us[100][100], user[100], n;
map<string, int> ma;
string q[10001];
vector<string> v;
void f(int x) {
  if (x == n) {
    int ans = 0, i, j;
    for (i = 1; i <= n; i++) {
      ans += user[i];
      for (j = i; j <= n; j++)
        if (user[i] == 1 && user[j] == 1 && us[i][j] == 1) return;
    }
    if (ans > mx) {
      mx = ans;
      for (i = 1; i <= n; i++) a[i] = user[i];
    }
    return;
  }
  user[x + 1] = 1;
  f(x + 1);
  user[x + 1] = 0;
  f(x + 1);
}
int main() {
  long long m, i, lol = 0;
  string s, p;
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> s;
    if (ma[s] == 0) lol++, ma[s] = lol, q[lol] = s;
  }
  for (i = 1; i <= m; i++) {
    cin >> s >> p;
    us[ma[s]][ma[p]] = 1;
    us[ma[p]][ma[s]] = 1;
  }
  f(0);
  for (i = 1; i <= n; i++)
    if (a[i] == 1) v.push_back(q[i]);
  sort(v.begin(), v.end());
  cout << v.size() << '\n';
  for (i = 0; i < v.size(); i++) cout << v[i] << '\n';
}
