#include <bits/stdc++.h>

using namespace std;

vector<vector<int>> g;
vector<vector<int>> q;
vector<int> used;
bool f;

void dfs(int v, int c) {
    used[v] = 1;
    for (auto u : g[v]) {
        if (abs(v - u) == 1 or abs(v - u) == g.size() - 1) continue;
        if (used[u] == 0) dfs(u, c);
        else if (used[u] == 1 and u == c) f = true;
    }
    used[v] = 2;
}

signed main() {
    int n, m, gg;
    cin >> n >> m >> gg;
    g.resize(n);
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        g[x].push_back(y);
        q[y].push_back(x);
    }
    int res = 0;
    for (int i = 0; i < n; i++) {
        if (q[i].size() > 2) res++;
    }
    if (res > 0) cout << n - res << '\n' << 1;
    else cout << n - 1 << '\n' << n;
}

