#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 3;
void read(int &x) {
  char ch;
  bool flag = 0;
  for (ch = getchar(); !isdigit(ch) && ((flag |= (ch == '-')) || 1);
       ch = getchar())
    ;
  for (x = 0; isdigit(ch); x = (x << 1) + (x << 3) + ch - 48, ch = getchar())
    ;
  x *= 1 - 2 * flag;
}
string fuck[maxn];
int edge[105][105];
map<string, int> cou;
int a[105], b[105];
int out = -1;
vector<string> output;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    string tmp;
    cin >> tmp;
    fuck[i] = tmp;
    cou[tmp] = i;
  }
  for (int i = 0; i < m; i++) {
    string c, d;
    cin >> c >> d;
    edge[cou[c]][cou[d]] = 1;
    edge[cou[d]][cou[c]] = 1;
  }
  int aa[50];
  for (int i = 0; i < (1 << n); i++) {
    memset(aa, 0, sizeof(aa));
    int top = 0;
    for (int j = 0; j < n; j++) {
      if (i & (1 << j)) {
        aa[j] = 1;
        top++;
      }
    }
    bool f = 1;
    for (int j = 0; j < n; j++) {
      for (int k = j + 1; k < n; k++) {
        if (aa[j] && aa[k] && edge[j][k]) {
          f = 0;
          break;
        }
      }
    }
    if (!f) continue;
    if (top > out) {
      out = top;
      output.clear();
      for (int j = 0; j < n; j++) {
        if (aa[j]) output.push_back(fuck[j]);
      }
    }
  }
  cout << output.size() << endl;
  sort(output.begin(), output.begin() + out);
  for (int i = 0; i < output.size(); i++) cout << output[i] << endl;
  return 0;
}
