#include<iostream>
#include<vector>
#include<set>
#include<cstring>
using namespace std;
int couple[100010];
int main()
{
int n, a, b, temp;
memset(couple, -1, 100010);
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
scanf("%d%d", &a, &b);
couple[a] = b;
couple[b] = a;
}
set<int> guest;
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
scanf("%d", &temp);
guest.insert(temp);
}
vector<int> ans;
for (auto iter = guest.begin(); iter != guest.end(); iter++)
{
if (couple[*iter] == -1)
ans.push_back(*iter);
if (couple[*iter] != -1 && guest.find(couple[*iter]) == guest.end())
ans.push_back(*iter);
}
printf("%d\n", ans.size());
for (int i = 0; i < ans.size(); i++)
{
printf("%05d", ans[i]);
if (i < ans.size() - 1) printf(" ");
}
system("pause");
return 0;
}
网友评论