#include <bits/stdc++.h>
using namespace std;

void dfs(vector<vector<int>>& g, int x, int y, int z, vector<bool>& used) {
    if (used[x]) {
        return;
    }
    used[x] = true;
    for (auto i : g[x]) {
        if ((x != y) || (i != z)) {
            dfs(g, i, y, z, used);
        }
    }
}

int main() {
    int n, m, G, q, r;
    cin >> n >> m >> G;
    if ((G < 3) || (G > 4)) {
        return 0;
    }
    vector<vector<int>> g(n, vector<int>(0));
    for (int i = 0; i < m; i++) {
        cin >> q >> r;
        q--;
        r--;
        g[q].push_back(r);
    }
    vector<vector<bool>> is_bridge(n);
    vector<bool> used;
    int not_bridges(0);
    for (int i = 0; i < n; i++) {
        is_bridge[i].assign(g[i].size(), false);
        for (int j = 0; j < g[i].size(); j++) {
            used.assign(n, false);
            dfs(g, i, i, g[i][j], used);
            if (!used[g[i][j]]) {
                is_bridge[i][j] = true;
            } else {
                not_bridges++;
            }
        }
    }
    cout << not_bridges << endl;
    cout << 1 << endl;
}
