#include <bits/stdc++.h>
using namespace std;
int n, m;
string members[16];
int hate[16][16] = {{0}};
int bitsIn(int x) {
  int bits = 0;
  int i = 0;
  while (x > 0) {
    if (x & 1) bits++;
    x = x >> 1;
  }
  return bits;
}
int solve(int member = 0, int mask = 0) {
  if (member == n) return mask;
  int takeMask = 0, leaveMask = 0;
  for (int i = 0; i < member; i++) {
    if (((mask & 1 << i) != 0) && hate[member][i]) {
      leaveMask = solve(member + 1, mask);
      return leaveMask;
    }
  }
  takeMask = solve(member + 1, mask | 1 << member);
  leaveMask = solve(member + 1, mask);
  int maxMask = bitsIn(takeMask) >= bitsIn(leaveMask) ? takeMask : leaveMask;
  return maxMask;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> members[i];
  for (int i = 0; i < m; i++) {
    string s1, s2;
    cin >> s1 >> s2;
    for (int j = 0; j < n; j++) {
      if (members[j] == s1) {
        for (int k = 0; k < n; k++) {
          if (members[k] == s2) {
            hate[j][k] = 1;
            hate[k][j] = 1;
          }
        }
      }
    }
  }
  int mask = solve();
  cout << bitsIn(mask) << endl;
  string team[16];
  int i = 0, j = 0;
  while (mask >= 1 << i) {
    if (mask & 1 << i) {
      team[j] = members[i];
      j++;
    }
    i++;
  }
  sort(team, team + j);
  for (int i = 0; i < j; i++) cout << team[i] << endl;
  return 0;
}
