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

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

void dfc(int x){

    could[i][x]=1;
    trace.push_back(x);
    if(x==t){
        for(int j=trace.size()-1;j>=0 && could[i][trace[j]]!=2;j--){
            could[i][trace[j]]=2;
        }
        return;
    }
    for(int 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(int l=trace.size()-1;l>=0 && could[i][trace[l]]!=2;l--){
                could[i][trace[l]]=2;
            }
        }
    }
    return;

}

int main(){

    int n,m,k;
    cin>>n>>m>>k;
    for(i=0;i<m;i++){
        int 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<int> ans;
    int br=0;
    for(i=1;i<=n;i++){
        for(int 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;
}
