#include <bits/stdc++.h>
#define D
using namespace std;
int n, m, k;
vector<int> lines[50000];
pair<int,int> groups[100];
bool through[50000] = {false};
int used[50000] = {0};
bool visited[50000] = {false};
void path(int start, int finish, vector<int> p){
    visited[start] = true;
    p.push_back(start);
    if(start == finish){
        for(int i = 0; i < p.size(); i++){
            //cout << p[i]+1 << ' ';
            through[p[i]] = true;
        }
        //cout << '\n';
        visited[start] = false;
        return;
    }
    for(int i = 0; i < lines[start].size(); i++){
        if(!visited[lines[start][i]]){
            //cout << start+1 << " goes through " << lines[start][i]+1 << '\n';
            path(lines[start][i],finish,p);
        }
    }
    visited[start] = false;
}
int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m >> k;
    int tmpa, tmpb;
    for(int i = 0; i < m; i++){
        cin >> tmpa >> tmpb;
        tmpa--; tmpb--;
        lines[tmpa].push_back(tmpb);
    }
    for(int i = 0; i < k; i++){
        cin >> groups[i].first >> groups[i].second;
        groups[i].first --;
        groups[i].second --;
    }
    int maxused = 0;
    for(int i = 0; i < k; i++){
        //cout << "group " << i+1 << ": " << groups[i].first+1 << " to " << groups[i].second+1 << '\n';
        for(int j = 0; j < n; j++){visited[j] = false;}
        for(int j = 0; j < n; j++){through[j] = false;}
        path(groups[i].first,groups[i].second,{});
        for(int i = 0; i < n; i++){
            if(through[i]){
                used[i]++;
                if(used[i] > maxused){maxused = used[i];}
            }
        }
    }
    vector<int> meeting_cities;
    for(int i = 0; i < n; i++){
        if(used[i] == maxused){meeting_cities.push_back(i+1);}
    }
    cout << meeting_cities.size() << '\n';
    for(int i = 0; i < meeting_cities.size(); i++){
        cout << meeting_cities[i] << ' ';
    }
    return 0;
}
