#include <bits/stdc++.h>
using namespace std;
vector<string> out;
map<string, int> M;
int m, n;
bool e[16][16];
string name[100];
int main() {
  cin >> n >> m;
  memset(e, false, sizeof(e));
  for (int i = 0; i < n; i++) {
    cin >> name[i];
    M[name[i]] = i;
  }
  for (int i = 0; i < m; i++) {
    string s1, s2;
    cin >> s1 >> s2;
    e[M[s1]][M[s2]] = true;
    e[M[s2]][M[s1]] = true;
  }
  int upperlim = 1 << n;
  int anscnt = -1, ansbit = 0;
  for (int s = 0; s < upperlim; s++) {
    bool suc = true;
    int cnt = 0;
    for (int i = 0; suc && (i < n); i++)
      if (s & (1 << i)) {
        cnt++;
        for (int j = i + 1; j < n; j++)
          if ((s & (1 << j)) && (e[i][j])) {
            suc = false;
            break;
          }
      }
    if (!suc) continue;
    if (cnt > anscnt) {
      anscnt = cnt;
      ansbit = s;
    }
  }
  cout << anscnt << endl;
  for (int i = 0; i < n; i++)
    if (ansbit & (1 << i)) out.push_back(name[i]);
  sort(out.begin(), out.end());
  for (int i = 0; i < anscnt; i++) cout << out[i] << endl;
  return 0;
}
