#include <bits/stdc++.h>
using namespace std;
long n, m;
string s[20];
string p1, p2;
int use[20] = {0};
int cant[20] = {0};
int ans[20] = {0};
int b[20][20] = {0};
bool f = true;
vector<string> a;
unsigned long long z = 0;
int num1, num2;
int Find(string& st) {
  {
    for (int i = 1; i <= n; i++)
      if (s[i] == st) return i;
  }
}
void rec(int pos, int k) {
  if (pos > n) {
    if (k > z) {
      for (int i = 1; i <= n; i++) ans[i] = use[i];
      z = k;
    }
    return;
  }
  int ch[17] = {0};
  int t;
  for (int i = pos; i <= n; i++) {
    t = i;
    if (!use[i] && !cant[i]) {
      use[i] = 1;
      for (int j = 1; j <= n; j++)
        if (b[i][j]) {
          if (!cant[j]) ch[j] = 1;
          cant[j] = 1;
        }
      rec(i + 1, k + 1);
      use[i] = 0;
      for (int j = 1; j <= n; j++)
        if (ch[j]) cant[j] = 0;
      rec(i + 1, k);
      break;
    }
  }
  if (t == n) {
    if (k > z) {
      for (int i = 1; i <= n; i++) ans[i] = use[i];
      z = k;
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
  }
  for (int i = 1; i <= m; i++) {
    cin >> p1 >> p2;
    num1 = Find(p1);
    num2 = Find(p2);
    b[num1][num2] = 1;
    b[num2][num1] = 1;
  }
  rec(1, 0);
  cout << z << endl;
  for (int i = 1; i <= n; i++)
    if (ans[i]) a.push_back(s[i]);
  sort(a.begin(), a.end());
  for (int i = 0; i < a.size(); i++) cout << a[i] << endl;
  return 0;
}
