#include <bits/stdc++.h>
using namespace std;
string a[205];
int flag[205];
deque<string> asw;
int m, n, i, maxn, ans, b[205][205];
map<string, int> w;
inline void po() {
  while (asw.size() > 0) asw.pop_back();
}
inline void countbit() {
  for (int i = 0; i < n; i++)
    if (flag[i] == 1) ans++;
}
void check() {
  ans = 0;
  countbit();
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      if (flag[i] == 1 && flag[j] == 1)
        if (b[i][j] == 1) ans = -1;
    }
  if (maxn < ans) {
    maxn = ans;
    po();
    for (int i = 0; i < n; i++) {
      if (flag[i] == 1) asw.push_back(a[i]);
    }
  }
}
void rek(int num) {
  if (n == num) {
    check();
    return;
  }
  flag[num] = 0;
  rek(num + 1);
  flag[num] = 1;
  rek(num + 1);
}
inline void lexi() {
  for (int i = 0; i < asw.size(); i++)
    for (int j = i + 1; j < asw.size(); j++)
      if (asw[i] > asw[j]) swap(asw[i], asw[j]);
}
int main() {
  string x, y;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    w[a[i]] = i;
  }
  for (i = 1; i <= m; i++) {
    cin >> x >> y;
    b[w[x]][w[y]] = 1;
    b[w[y]][w[x]] = 1;
  }
  rek(0);
  cout << maxn << endl;
  lexi();
  for (int i = 0; i < asw.size(); i++) {
    cout << asw[i] << endl;
  }
  return 0;
}
