#include <bits/stdc++.h>
using namespace std;

long long i=0;
long long s,t;
long long could[101][50005];///0-unused 1-used 2-winning
vector<long long> v[50005],trace;

void dfc(long long x){

    could[i][x]=1;
    trace.push_back(x);
    if(x==t){
        for(long long j=trace.size()-1;j>=0/* && could[i][trace[j]]!=2*/;j--){
            could[i][trace[j]]=2;
        }
        return;
    }
    for(long long j=0;j<v[x].size();j++){
        if(could[i][v[x][j]]==0){
            dfc(v[x][j]);
            trace.pop_back();
        }else if(could[i][v[x][j]]==2){
            for(long long l=trace.size()-1;l>=0/* && could[i][trace[l]]!=2*/;l--){
                could[i][trace[l]]=2;
            }
        }
    }
    return;

}

int main(){

    long long n,m,k;
    cin>>n>>m>>k;
    for(i=0;i<m;i++){
        long long a,b;
        cin>>a>>b;
        v[a].push_back(b);
    }
    for(i=0;i<k;i++){
        cin>>s>>t;
        dfc(s);
        while(trace.size()>0){
            trace.pop_back();
        }
    }
    vector<long long> ans;
    long long br=0;
    for(i=1;i<=n;i++){
        for(long long j=0;j<k;j++){
            if(could[j][i]==2){
                br++;
            }
        }
        if(br==k){
            ans.push_back(i);
        }
        br=0;
    }
    cout<<ans.size()<<endl;
    for(i=0;i<ans.size();i++){
        cout<<ans[i]<<" ";

    }

    return 0;
}
