#include <bits/stdc++.h>
using namespace std;
string to_string(char s) { return "\'" + string(1, s) + "\'"; }
string to_string(string s) { return "\"" + s + "\""; }
template <typename T>
string to_string(vector<T>);
template <typename T>
string to_string(set<T>);
template <typename U, typename V>
string to_string(map<U, V>);
template <typename U, typename V>
string to_string(pair<U, V> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename T>
string to_string(vector<T> v) {
  string s = "[ ";
  for (auto e : v) s += to_string(e) + " ";
  s += "]";
  return s;
  ;
}
template <typename T>
string to_string(set<T> v) {
  string s = "[ ";
  for (auto e : v) s += to_string(e) + " ";
  s += "]";
  return s;
  ;
}
template <typename U, typename V>
string to_string(map<U, V> v) {
  string s = "[ ";
  for (auto e : v) s += to_string(e) + " ";
  s += "]";
  return s;
  ;
}
int n, m;
int maxp;
int ans;
char s[13];
char x[13];
char y[13];
vector<vector<int> > adj;
map<int, string> name;
map<string, int> number;
void calc(int bitmask, int i, int cnt) {
  if (cnt > maxp) {
    maxp = cnt;
    ans = bitmask;
  }
  if (i == n) return;
  int c = 0;
  for (int j = 0; j < (int)adj[i].size(); j++)
    if ((bitmask & (1 << adj[i][j]))) c++;
  if (c == 0) calc(bitmask | (1 << i), i + 1, cnt + 1);
  calc(bitmask, i + 1, cnt);
}
int main() {
  scanf("%d %d", &n, &m);
  adj.assign(n, vector<int>(0));
  int no = 0;
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    number[string(s)] = no;
    name[no++] = string(s);
  }
  for (int i = 0; i < m; i++) {
    scanf("%s %s", x, y);
    int u = number[string(x)];
    int v = number[string(y)];
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  calc(0, 0, 0);
  vector<string> anss;
  printf("%d\n", maxp);
  for (int i = 0; i < n; i++) {
    if ((ans & (1 << i))) anss.push_back(name[i]);
  }
  sort(anss.begin(), anss.end());
  for (int i = 0; i < (int)anss.size(); i++) printf("%s\n", anss[i].data());
}
