#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j, k;
  cin >> n >> m;
  string a1, a2;
  string b[20];
  int cnt = 1;
  map<string, int> x;
  for (i = 1; i <= n; i++) {
    cin >> b[i];
    x[b[i]] = i;
    cnt = cnt * 2;
  }
  int c[20][20] = {0};
  for (j = 1; j <= m; j++) {
    cin >> a1 >> a2;
    c[x[a1]][x[a2]]++;
    c[x[a2]][x[a1]]++;
  }
  cnt--;
  int flag = 0;
  int req[21] = {0};
  int aa, bb;
  int max = -1;
  int reqcnt = 1;
  for (; cnt >= 1; cnt--) {
    flag = 0;
    j = 0;
    k = cnt;
    for (i = 1; i <= 20; i++) {
      req[i] = 0;
    }
    for (i = 1; i <= n; i++) {
      if (k & 1 == 1) {
        req[j] = i;
        j++;
      }
      k = k >> 1;
    }
    for (aa = 0; aa < j; aa++) {
      for (bb = aa + 1; bb < j; bb++) {
        if (c[req[aa]][req[bb]] == 1) {
          flag = 1;
          break;
        }
      }
    }
    if (flag == 0) {
      if (max < j) {
        max = j;
        reqcnt = cnt;
      }
    }
  }
  cout << max << endl;
  k = reqcnt;
  j = 0;
  for (i = 1; i <= n; i++) {
    if (k & 1 == 1) {
      req[j] = i;
      j++;
    }
    k = k >> 1;
  }
  map<string, int>::iterator it;
  int deg[21] = {0};
  for (i = 0; i < j; i++) {
    deg[req[i]] = 1;
  }
  for (it = x.begin(); it != x.end(); it++) {
    if (deg[it->second] != 0) {
      cout << it->first << endl;
    }
  }
  return 0;
}
