#pragma GNU optimize("O3")
#pragma GNU optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;
//#define push_back push_back
#define in insert
#define int long long
#define ll long long
#define inf 1000000000000000000
#define N 2000
#define de 1000000007
int used[N];
vector< pair<int, int> > edge;
set< pair<int, int> > g;
vector<int> gr[N], grm[N];
pair<int, int> del;

void DFS(int v){
    if(used[v]) return;
    used[v] = 1;
    for(int u: gr[v]){
        if(used[u] || (v == del.first && u == del.second)) continue;
        DFS(u);
    }
}

void tup(){
    int n, m, _; cin >> n >> m >> _;
    for(int i = 0; i < m; i++){
        int u, v; cin >> u >> v; u--, v--;
        gr[u].push_back(v);
        edge.push_back({u, v});
    }
    int ans = 1, ma = 0;
    for(pair<int, int> r: edge){
        if(g.count(r)) continue;
        for(int &i: used) i = 0;
        int v = r.first, u = r.second;
        del = r;
        DFS(v);
        if(used[u]) continue;
        ma++;
        for(pair<int, int> p: edge){
            if(used[p.first] != used[p.second]) g.in(p);
        }
    }
    cout << ma << endl;
    cout << 1;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    tup();
}