#include <bits/stdc++.h>
using namespace std;
void input(long &n) { scanf("%ld", &n); }
void input(long long &n) { scanf("%lld", &n); }
char temp[12], tempo[12];
void sort(char aNames[][12], long l, long r) {
  long i = l;
  long j = r;
  long mid = (i + j) >> 1;
  strcpy(tempo, aNames[mid]);
  while (i <= j) {
    while (strcmp(aNames[i], tempo) < 0) i++;
    while (strcmp(aNames[j], tempo) > 0) j--;
    if (i <= j) {
      strcpy(temp, aNames[i]);
      strcpy(aNames[i], aNames[j]);
      strcpy(aNames[j], temp);
      i++;
      j--;
    }
  }
  if (i < r) sort(aNames, i, r);
  if (j > l) sort(aNames, l, j);
}
char name1[12], name2[12];
void input(long &n, long &m, char aNames[][12], bool a[][17]) {
  input(n);
  input(m);
  for (long i = 0; i < n; i++) {
    scanf("%s", aNames[i]);
  }
  sort(aNames, 0, n - 1);
  for (long i = 0; i < n; i++) {
    for (long j = 0; j < n; j++) a[i][j] = false;
  }
  for (long i = 0; i < m; i++) {
    scanf("%s %s", name1, name2);
    long id1, id2;
    for (long j = 0; j < n; j++) {
      if (strcmp(name1, aNames[j]) == 0) {
        id1 = j;
      }
      if (strcmp(name2, aNames[j]) == 0) {
        id2 = j;
      }
    }
    a[id1][id2] = a[id2][id1] = true;
  }
}
void save(long n, bool tempx[], bool x[]) {
  for (long i = 0; i < n; i++) x[i] = tempx[i];
}
void dosolve(long n, bool a[][17], bool tempx[], long id, long tempcount,
             bool x[], long &count) {
  if (id >= n) {
    if (tempcount > count) {
      save(n, tempx, x);
      count = tempcount;
    }
    return;
  }
  for (long j = id; j < n; j++) {
    bool bConflict = false;
    for (long i = 0; i < n; i++)
      if (tempx[i] && a[i][j]) {
        bConflict = true;
        break;
      }
    if (bConflict) continue;
    tempx[j] = true;
    dosolve(n, a, tempx, j + 1, tempcount + 1, x, count);
    tempx[j] = false;
    if (count == n) return;
  }
  dosolve(n, a, tempx, n, tempcount, x, count);
}
void solve(long n, long m, bool a[][17], bool x[], bool tempx[]) {
  for (long i = 0; i < n; i++) tempx[i] = x[i] = false;
  x[0] = true;
  long count = 1;
  dosolve(n, a, tempx, 0, 0, x, count);
}
void output(long n) { printf("%ld\n", n); }
void output(long n, char aNames[][12], bool x[]) {
  long count = 0;
  for (long i = 0; i < n; i++)
    if (x[i]) count++;
  output(count);
  for (long i = 0; i < n; i++)
    if (x[i]) printf("%s\n", aNames[i]);
}
long n, m;
char aNames[17][12];
bool a[17][17], x[17], tempx[17];
int main() {
  input(n, m, aNames, a);
  solve(n, m, a, x, tempx);
  output(n, aNames, x);
}
