#include<bits/stdc++.h>
//#pragma GCC target("avx2")
//#define int long long
#define F first
#define S second

using namespace std;

const int N = 3000+10;

vector<int> g[N], g_ob[N];

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);
    int n, m, g;
    cin>>n>>m>>g;
    vector<pair<int, int>> v;
    for(int i = 1; i <= m; i++)
    {
        int x, y;
        cin>>x>>y;
//        g[x].push_back(y);
        g_ob[y].push_back(x);
        v.push_back({x, y});
    }
    cout<<n-1<<"\n1";

}

