#include <bits/stdc++.h>
using namespace std;
const int N = 16;
int n, m;
string name[N];
int a[N][N];
int GetCount(int k) {
  int i = 0;
  while (k > 0) {
    i += k % 2;
    k /= 2;
  }
  return i;
}
int main() {
  int i, ans, j, k, maxres;
  int nA, nB;
  char szName[32] = {0};
  char szA[32] = {0};
  char szB[32] = {0};
  while (scanf("%d%d", &n, &m) == 2) {
    for (i = 0; i < n; ++i) {
      scanf("%s", szName);
      name[i] = szName;
    }
    sort(name, name + n);
    memset(a, 0, sizeof(a));
    for (i = 0; i < m; ++i) {
      scanf("%s%s", szA, szB);
      for (j = 0; j < n; ++j) {
        if (strcmp(name[j].c_str(), szA) == 0) nA = j;
        if (strcmp(name[j].c_str(), szB) == 0) nB = j;
      }
      a[nA][nB] = a[nB][nA] = 1;
    }
    maxres = 0;
    for (ans = 1; ans < (1 << n); ++ans) {
      bool ok = true;
      for (i = 0; i < n; ++i)
        for (j = 0; j < n; ++j) {
          nA = (1 << i) & ans;
          nB = (1 << j) & ans;
          if (nA == 0 || nB == 0) continue;
          if (a[i][j] > 0) ok = false;
        }
      if (!ok) continue;
      if (GetCount(ans) > GetCount(maxres)) maxres = ans;
    }
    int res[16];
    ans = 0;
    for (i = 0; i < n; ++i)
      if ((maxres & (1 << i)) > 0) res[ans++] = i;
    printf("%d\n", ans);
    for (i = 0; i < ans; ++i) printf("%s\n", name[res[i]].c_str());
  }
  return 0;
}
