#include <bits/stdc++.h>
using namespace std;
long long g[20][20];
void solve() {
  long long n, m;
  cin >> n >> m;
  map<long long, string> mp;
  map<string, long long> inv;
  for (long long i = 0; i < n; ++i) {
    string s;
    cin >> s;
    mp[i] = s;
    inv[s] = i;
  }
  for (long long i = 0; i < m; i++) {
    string a, b;
    cin >> a >> b;
    g[inv[a]][inv[b]] = 1;
    g[inv[b]][inv[a]] = 1;
  }
  vector<string> anss;
  for (long long mask = 0; mask < (1 << n); mask++) {
    bool ans = true;
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < n; j++) {
        if (((1 << i) & mask) and ((1 << j) & mask) and g[i][j]) {
          ans = false;
          break;
        }
      }
    }
    if (ans and __builtin_popcount(mask) > anss.size()) {
      anss.clear();
      for (long long i = 0; i < n; i++)
        if (mask & (1 << i)) anss.push_back(mp[i]);
    }
  }
  sort(anss.begin(), anss.end());
  cout << anss.size() << '\n';
  for (auto x : anss) cout << x << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long t = 1;
  while (t--) solve();
  return 0;
}
