#include <bits/stdc++.h>
using namespace std;
int n, m;
char name1[128], name2[128];
map<string, int> m1;
map<int, string> m2;
bool adj[32][32];
bool visited[32];
vector<int> res;
vector<int> resg;
bool cmp(int a, int b) { return m2[a] < m2[b]; }
int run(int u) {
  if (u == n) {
    if (res.size() > resg.size()) resg = res;
    return 0;
  }
  int op1 = run(u + 1);
  bool fail = false;
  for (int i = 0; i < (int)res.size(); i++)
    if (adj[res[i]][u]) fail = true;
  int op2 = 0;
  if (!fail) {
    res.push_back(u);
    op2 = 1 + run(u + 1);
    res.pop_back();
  }
  return max(op1, op2);
}
int main() {
  m1.clear();
  m2.clear();
  memset(adj, false, sizeof(adj));
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%s", name1);
    string n1 = name1;
    m1[n1] = i;
    m2[i] = n1;
  }
  for (int i = 0; i < m; i++) {
    scanf("%s %s", name1, name2);
    string n1 = name1;
    string n2 = name2;
    adj[m1[n1]][m1[n2]] = true;
    adj[m1[n2]][m1[n1]] = true;
  }
  memset(visited, false, sizeof(visited));
  res.clear();
  printf("%d\n", run(0));
  sort(resg.begin(), resg.end(), cmp);
  for (int i = 0; i < (int)resg.size(); i++)
    printf("%s\n", m2[resg[i]].c_str());
  return 0;
}
