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

bool curr[50009], ans[50009], p[50009];
int n, m, k;
vector<int> graph[50009];

void dfs(int c, int t, stack<int> ob){
    if(c == t){
        while(ob.size() > 1){
            curr[ob.top()] = true;
            ob.pop();
        }
        return;
    }
    p[c] = true;
    ob.push(c);
    for(auto i : graph[c]){
        if(!p[i]) dfs(i, t, ob);
    }
    p[c] = false;
}

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin >> n >> m >> k;
    for(int i = 1; i <= n; i++) ans[i] = true;
    for(int i = 1; i <= m; i++){
        int f, t;
        cin >> f >> t;
        graph[f].push_back(t);
    }
    if(k == 1){
        int f, t;
        stack<int> b;
        cin >> f >> t;
        dfs(f, t, b);
        vector<int> otg;
        for(int i = 1; i <= n; i++){
            if(curr[i]) otg.push_back(i);
        }
        cout << otg.size() << "\n";
        sort(otg.begin(), otg.end());
        for(auto i : otg) cout << i << " ";
        return 0;
    }
    for(int i = 1; i <= k; i++){
        int f, t;
        stack<int> b;
        cin >> f >> t;
        for(int i = 1; i <= n; i++){
            p[i] = false;
            curr[i] = false;
        }
       // curr[t] = true;
        //curr[f] = true;
        dfs(f, t, b);
        for(int i = 1; i <= n; i++){
            if(ans[i] and !curr[i]) ans[i] = false;
        }
    }

    vector<int> otg;
    for(int i = 1; i <= n; i++){
        if(ans[i]) otg.push_back(i);
    }
    cout << otg.size() << "\n";
    sort(otg.begin(), otg.end());
    for(auto i : otg) cout << i << " ";


    return 0;
}
