题目 

#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	int n;
	cin>>n;
	int t,p;
	int a[100002],b[100002],d[10002];
	bool c[100002]= {0};
	for(int i=0; i<n; ++i) {
		cin>>t>>p;
		a[t]=p;//数组双存储
		a[p]=t;
	}
	int m;
	int ans=0;
	cin>>m;
	for(int i=0; i<m; ++i) {
		cin>>t;
		c[t]=1;
		d[i]=t;
	}
	for(int i=0; i<m; ++i)
		if(!c[a[d[i]]])
			b[ans++]=d[i];
	sort(b,b+ans);
	cout<<ans<<endl;
	if(ans)
		printf("%05d",b[0]);
	for(int i=1; i<ans; ++i)
		printf(" %05d",b[i]);
	return 0;
}