#include <bits/stdc++.h>

using namespace std;

void solve() {
    int n, m, subtask;
    cin >> n >> m >> subtask;
    vector<vector<int>> g(n);
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        g[u].push_back(v);
    }
    auto count = [&](int v, int blocked) -> int {
        vector<int> used(n);
        queue<int> q;
        q.push(v);
        used[v] = 1;
        int ans = 1;
        while (!q.empty()) {
            int nw = q.front();
            q.pop();
            for (auto nxt : g[nw]) {
                if (!used[nxt] && (nw != v || nxt != blocked)) {
                    q.push(nxt);
                    used[nxt] = 1;
                    ans++;
                }
            }
        }
        return ans;
    };
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int cnt_all = count(i, -1);
        for (auto j : g[i]) {
            if (count(i, j) != cnt_all) {
                assert(j != i + 1);
                ans++;
            }
        }
    }
    cout << ans << '\n';
    cout << 1 << '\n';
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
