#include <bits/stdc++.h>
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const long long int int_max = 1e18;
const long long int int_min = -1e18;
using namespace std;
long long int power(long long int x, long long int y) {
  long long int temp;
  if (y == 0) return 1;
  temp = power(x, y / 2);
  if (y % 2 == 0)
    return temp * temp;
  else {
    if (y > 0)
      return x * temp * temp;
    else
      return (temp * temp) / x;
  }
}
void solve() {
  long long int n, m1;
  cin >> n >> m1;
  string s[n + 2];
  for (long long int i = 1; i <= n; i++) {
    cin >> s[i];
  }
  map<pair<string, string>, long long int> m;
  for (long long int i = 1; i <= m1; i++) {
    string s1, s2;
    cin >> s1 >> s2;
    m[{s1, s2}] = 1;
    m[{s2, s1}] = 1;
  }
  long long int temp = power(2ll, n);
  temp--;
  int flg = 0;
  long long int mx = 0;
  vector<string> finalans;
  for (long long int i = 1; i <= temp; i++) {
    vector<string> v;
    for (long long int j = 0; j <= n - 1; j++) {
      long long int temp1 = power(2ll, j);
      if (temp1 & i) {
        v.push_back(s[j + 1]);
      }
    }
    for (long long int j = 0; j <= v.size() - 1; j++) {
      for (long long int j1 = j + 1; j1 <= v.size() - 1; j1++) {
        if (m[{v[j], v[j1]}] == 1) {
          flg = 1;
          break;
        }
      }
    }
    if (flg == 0) {
      if (mx < v.size()) {
        mx = v.size();
        finalans = v;
      }
    }
    flg = 0;
    v.clear();
  }
  sort(finalans.begin(), finalans.end());
  cout << finalans.size() << '\n';
  for (string i : finalans) {
    cout << i << '\n';
  }
}
int main() {
  ios::sync_with_stdio(false), cin.tie(NULL);
  solve();
}
