#include <bits/stdc++.h>
using namespace std;
const int N = 16;
int edge[((1) << (N))];
int cnt[((1) << (N))];
int main() {
  int n, m;
  cin >> n >> m;
  map<string, int> mem;
  vector<string> all(n);
  for (int i = 0; i < (n); ++i) {
    string name;
    cin >> name;
    mem[name] = i;
    all[i] = name;
  }
  for (int i = 0; i < (m); ++i) {
    string a, b;
    cin >> a >> b;
    edge[((1) << (mem[a]))] |= ((1) << (mem[b]));
    edge[((1) << (mem[b]))] |= ((1) << (mem[a]));
  }
  int ans = 0, best = 0;
  for (typeof(1) mk = 1; mk < ((1) << (n)); ++mk) {
    edge[mk] = edge[mk ^ ((mk) & ((mk) ^ ((mk)-1)))] |
               edge[((mk) & ((mk) ^ ((mk)-1)))];
    cnt[mk] = cnt[mk ^ ((mk) & ((mk) ^ ((mk)-1)))] + 1;
    ;
    ;
    if (0 == (edge[mk] & mk) && ans < cnt[mk]) {
      best = mk;
      ans = cnt[mk];
      ;
      ;
    }
  }
  vector<string> team;
  for (int i = 0; i < (n); ++i)
    if (((1) << (i)) & best) team.push_back(all[i]);
  sort((team).begin(), (team).end());
  cout << ans << endl;
  for (int i = 0; i < (((int)(team).size())); ++i) cout << team[i] << endl;
  return 0;
}
