#include <bits/stdc++.h>
using namespace std;
void openfile() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
const int nmax = 1 << 16;
int n, k;
int a[nmax];
vector<string> name;
map<string, int> num;
vector<vector<int> > g;
int main() {
  cin >> n >> k;
  g.resize(n);
  name.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> name[i];
    num[name[i]] = i;
  }
  for (int i = 0; i < k; i++) {
    string s1, s2;
    cin >> s1 >> s2;
    int v1 = num[s1], v2 = num[s2];
    g[v1].push_back(v2);
    g[v2].push_back(v1);
  }
  int ans, cans = 0;
  for (int i = 0; i < nmax; i++) {
    int cur = 0;
    for (int j = 0; j < n; j++) {
      if (i & (1 << j)) cur++;
    }
    for (int j = 0; j < n; j++) {
      if (i & (1 << j)) {
        for (int q = 0; q < ((int)((g[j]).size())); q++) {
          if (i & (1 << g[j][q])) {
            cur = 0;
            break;
          }
        }
      }
    }
    if (cur > cans) {
      ans = i;
      cans = cur;
    }
  }
  cout << cans << endl;
  set<string> b;
  for (int i = 0; i < n; i++) {
    if (ans & (1 << i)) {
      b.insert(name[i]);
    }
  }
  for (set<string>::iterator it = b.begin(); it != b.end(); it++) {
    cout << *it << endl;
  }
  return 0;
}
