#include <bits/stdc++.h>
using namespace std;
vector<int> res;
vector<int> tmp;
map<string, int> idx;
string Name[17];
int a[17][17];
int n, m;
void Read_Input() {
  string x, y;
  int u, v;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    cin >> x;
    Name[i] = x;
  }
  sort(Name + 1, Name + 1 + n);
  for (int i = 1; i <= n; i++) idx[Name[i]] = i;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    u = idx[x];
    v = idx[y];
    a[u][v] = a[v][u] = 1;
  }
}
void Try(int k) {
  if (tmp.size() > res.size()) {
    res = tmp;
  }
  if (k > n) return;
  bool ok = true;
  for (int i = 0; i < tmp.size(); i++)
    if (a[tmp[i]][k]) {
      ok = false;
      break;
    }
  if (ok) {
    tmp.push_back(k);
    Try(k + 1);
    tmp.pop_back();
  }
  Try(k + 1);
}
void Solve() { Try(1); }
void Write_Output() {
  printf("%d\n", res.size());
  for (int i = 0; i < res.size(); i++) cout << Name[res[i]] << endl;
}
int main() {
  Read_Input();
  Solve();
  Write_Output();
}
