#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m, c = 0, i, j, ans = 0;
  cin >> n >> m;
  string s, s1[n], s2;
  map<string, long long> a;
  vector<pair<long long, long long>> b;
  vector<string> ss;
  for (i = 0; i < n; i++) {
    cin >> s;
    a[s] = i;
    s1[i] = s;
  }
  for (i = 0; i < m; i++) {
    cin >> s >> s2;
    b.push_back({a[s], a[s2]});
  }
  for (i = 1; i < (1LL << n); i++) {
    c = 0;
    for (auto x : b) {
      long long g = x.first, h = x.second;
      if (((1 << g) & i) && ((1 << h) & (i))) {
        c = 1;
        break;
      }
    }
    if (c == 0 && __builtin_popcountll(i) >= __builtin_popcountll(ans)) {
      ans = i;
    }
  }
  cout << __builtin_popcountll(ans) << endl;
  for (i = 0; i < 16; i++) {
    if (ans & (1 << i)) {
      ss.push_back(s1[i]);
    }
  }
  sort(ss.begin(), ss.end());
  for (auto x : ss) cout << x << endl;
}
