#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

long long n,m,k,otg[50000],ind;
vector<long long> neighbors[50003];
bool v[100][50003],f[100][50003];
bool dfs(long long ot, long long doo, long long nast, int k){
    if(nast==doo) return 1;
    if(f[k][nast]) return v[k][nast];
    f[k][nast]=true;
    //cout<< "(" << k << " " << nast << ")" << endl;
    for(long long i=0;i<neighbors[nast].size();i++){
        //cout<< "nast=" << nast << " >> " << neighbors[nast][i] << " || ";
        dfs(ot,doo,neighbors[nast][i],k);
        if(v[k][neighbors[nast][i]]){
            v[k][nast]=true;
            //cout<< k << " :: " << nast << endl;
        }
    }
    return 0;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>> n >> m >> k;
    for(long long i=0;i<m;i++){
        long long x,y;
        cin>> x >> y;
        x--;
        y--;
        neighbors[x].push_back(y);
    }
    for(int i=0;i<k;i++){
        long long x,y;
        cin>> x >> y;
        x--;
        y--;
        v[i][y]=true;
        dfs(x,y,x,i);
        v[i][y]=false;
        v[i][x]=false;
    }
    for(long long i=0;i<n;i++){
        bool flag=true;
        for(int j=0;j<k;j++){
            if(!v[j][i]){
                flag=false;
                break;
            }
        }
        if(flag){
            otg[ind]=i+1;
            ind++;
        }
    }
    cout<< ind << endl;
    sort(otg,otg+ind);
    for(long long i=0;i<ind;i++){
        cout<< otg[i] << " ";
    }






    return 0;
}