文件目录

#include <bits/stdc++.h>
using namespace std;
int fat[105];
int n, m, x, y;
int maxf[105], id = 0;
int main()
{
    cin >> n >> m;
    while (m--)
    {
        cin >> x >> y;
        fat[y] = x;
        maxf[x]++;
        if (maxf[id] < maxf[x])
            id = x;
    }
    for (int i = 1; i <= n; i++)
        if (fat[i] == 0)
        {
            cout << i << endl;
            break;
        }
    cout << id << endl;
    for (int i = 1; i <= n; i++)
        if (fat[i] == id)
            cout << i << " ";
    return 0;
}