//#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 cnt1 = 0, cnt2 = 0, cntc = 0, cnte = 0;

void dfs(int v) {
    used[v] = 1;
    for (auto to : g[v]) {
        if (used[to] == 1) cnt1++;
        if (used[to] == 2) cnt2++;
        if (used[to] != 1) dfs(to);
    }
    t.push_back(v);
    used[v] = 2;
}

void dfs2(int v) {
    used[v] = 1;
    for (auto to : tg[v]) {
        if (used[to] != 1) dfs2(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;
    for (int i = 0; i < m; ++i) {
        cin >> u >> v;
        --v; --u;
        g[u].push_back(v);
        tg[v].push_back(u);
    }
    for (int v = 0; v < n; ++v) {
        if (used[v] == 0) dfs(v), cntc++;
    }
    reverse(t.begin(), t.end());
    used.assign(n, 0);
    for (auto v : t) {
        if (used[v] == 0) dfs2(v), cntc++;
    }
    cout << m - cnt1 << '\n';
    cout << 1 << '\n';
}
