#include <bits/stdc++.h>
using namespace std;
int N, M;
map<string, set<string>> hate;
string names[17];
vector<string> ans;
int dp[17][1 << 17];
int solve(int idx, int mask) {
  if (idx == N) return 0;
  if (dp[idx][mask] != -1) return dp[idx][mask];
  dp[idx][mask] = solve(idx + 1, mask);
  bool canTake = true;
  for (int i = 0; i < N; i++) {
    if (i == idx) continue;
    if ((1 << i) & mask) {
      for (set<string>::iterator it = hate[names[i]].begin();
           it != hate[names[i]].end(); it++) {
        if (names[idx] == *it) canTake = false;
      }
    }
  }
  if (canTake)
    dp[idx][mask] = max(dp[idx][mask], solve(idx + 1, mask | (1 << idx)) + 1);
  return dp[idx][mask];
}
void print(int idx, int mask) {
  if (idx == N) return;
  if (dp[idx][mask] == solve(idx + 1, mask))
    print(idx + 1, mask);
  else if (dp[idx][mask] == solve(idx + 1, mask | (1 << idx)) + 1) {
    ans.push_back(names[idx]);
    print(idx + 1, mask | (1 << idx));
  }
}
int main() {
  cin >> N >> M;
  string first, second;
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < N; i++) {
    cin >> names[i];
  }
  for (int i = 0; i < M; i++) {
    cin >> first >> second;
    hate[first].insert(second);
    hate[second].insert(first);
  }
  cout << solve(0, 0) << endl;
  print(0, 0);
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << endl;
  }
  return 0;
}
