#include<bits/stdc++.h>
#define MAXN 50010
#define MAXM 100000
#define MAXK 100
using namespace std;
vector<int> graph[MAXN], graph2[MAXN];
bool visited1[MAXN], visited2[MAXN], ans[MAXN];
void dfs(int x, int k){
    if(k == 1){
        if(visited1[x]){
            return;
        }
        visited1[x] = true;
        for(auto i:graph[x]){
            dfs(i, 1);
        }
    }else{
        if(visited2[x]){
            return;
        }
        visited2[x] = true;
        for(auto i:graph2[x]){
            //cout << "x:" << x << " i:"<< i << "\n";
            dfs(i, 2);
        }
    }
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n, m, k;
    cin >> n >> m >> k;
    for(int i = 0; i < m; i++){
        int x, y;
        cin >> x >> y;
        graph[x].push_back(y);
        graph2[y].push_back(x);
    }
    //cout << "---------\n";
    for(int i = 0; i < k; i++){
        int x, y;
        cin >> x >> y;
        /*if(i == 1){
            cout << "--------------------------\n";
        }*/
        dfs(x, 1);
        dfs(y, 2);
        for(int j = 1; j <= n; j++){
            if(visited1[j] and visited2[j]){
                if(i == 0){
                    ans[j] = true;
                    //cout << "new ans:" << j << "\n";
                }
            }else if(ans[j]){
                ans[j] = false;
                //cout << "delete ans:" << j << "\n";
            }
            if(visited1[j]){
                visited1[j] = false;
            }
            if(visited2[j]){
                visited2[j] = false;
            }
        }
        //cout << endl;
    }
    int otg = 0;
    for(int i = 1; i <= n; i++){
        if(ans[i]){
            otg ++;
        }
    }
    cout << otg << "\n";
    for(int i = 1; i <= n; i++){
        if(ans[i]){
            cout << i << " ";
        }
    }
    return 0;
}
