//#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

vector<vector<int>> g, tg;
vector<int> used, t;
int cnt = 0;

void dfs(int v) {
    if (used[v] == 0) cnt++;
    used[v] = 1;
    for (auto to : g[v]) {
        if (used[to] == 1) continue;
        dfs(to);
    }
    used[v] = 2;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m, q;
    cin >> n >> m >> q;
    g.resize(n); used.resize(n); tg.resize(n);
    int u, v;
//    vector<pair<int, int>> e;
    for (int i = 0; i < m; ++i) {
        cin >> u >> v;
        --v; --u;
        g[u].push_back(v);
//        e.push_back({u, v});
    }
    int res = m;
    for (int i = 0; i < n; ++i) {
        if (used[i] == 0) {
            dfs(i);
            res -= cnt - 1;
            cnt = 0;
        }
    }
    cout << res << '\n';
    cout << 1 << '\n';
}
