#include <bits/stdc++.h>
using namespace std;
int all, bad, ans = 0;
map<string, int> name;
map<int, string> _name;
int dead[16][16];
vector<int> mask;
void dfs(int n, vector<bool>& arr) {
  if (n == all) {
    for (int i = 0; i < all; i++) {
      if (arr[i]) {
        for (int j = 0; j < all; j++) {
          if (arr[j] && dead[i][j]) {
            return;
          }
        }
      }
    }
    int c = (int)count(arr.begin(), arr.end(), true);
    if (c > ans) {
      ans = c;
      for (int i = 0; i < all; i++) {
        mask[i] = arr[i];
      }
    }
    return;
  }
  dfs(n + 1, arr);
  arr[n] = true;
  dfs(n + 1, arr);
  arr[n] = false;
}
int main() {
  cin >> all >> bad;
  for (int i = 0; i < all; i++) {
    string s;
    cin >> s;
    name[s] = i;
    _name[i] = s;
  }
  for (int i = 0; i < bad; i++) {
    string a, b;
    cin >> a >> b;
    int x = name[a], y = name[b];
    dead[x][y] = 1;
    dead[y][x] = 1;
  }
  mask.resize(all);
  vector<bool> arr(all, false);
  dfs(0, arr);
  cout << ans << endl;
  vector<string> k;
  for (int i = 0; i < all; i++) {
    if (mask[i]) {
      k.push_back(_name[i]);
    }
  }
  sort(k.begin(), k.end());
  for (auto& i : k) cout << i << endl;
}
