#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

#define int long long

vector<int> used, top, cs;

int n, m;
int ck = 0;

void tps(int v, vector<vector<int> > &G) {
    used[v] = 1;
    ck++;
    for (int u : G[v]) {
        if (used[u]) continue;
        tps(u, G);
    }
    top.push_back(v);
}

void cond(int v, int c, vector<vector<int> > &G) {
    cs[v] = c;
    for (int u :G[v]) {
        if (cs[u] >= 0) continue;
        cond(u, c, G);
    }
}

void COND(vector<vector<int> > G) {
    top.clear();
    used.assign(n, 0);
    cs.assign(n, -1);
    vector<vector<int> > TG(n, vector<int> (0));
    for (int v = 0; v < n; v++) {
        for (int u : G[v]) {
            TG[u].push_back(v);
        }
    }
    for (int i = 0; i < n; i++) {
        if (!used[i]) {
            tps(i, G);
        }
    }
    reverse(top.begin(), top.end());
    int C = 0;
    for (int v : top) {
        if (cs[v] == -1) {
            cond(v, C, TG); C++;
        }
    }
}

signed main() {
    cin.tie(0);
    cout.tie(0);
    int G; cin >> n >> m >> G;
    vector<vector<int> > g(n, vector<int> (0));
    vector<vector<int> > tg(n, vector<int> (0));
    vector<pair<int, int> > es;
    used.assign(n, 0);
    int cn = 0;
    for (int i = 0; i < m; i++) {
        int u, v; cin >> u >> v; u--; v--;
        g[u].push_back(v);
        tg[v].push_back(u);
    }
    used.assign(n, 0);
    int mx = 0;
    for (int v = 0; v < n; v++) {
        if (used[v]) continue;
        ck = 0;
        tps(v, g);
        mx += ck - 1;
    }
    reverse(top.begin(), top.end());
    int ans = 0;
    for (int v : top) {
        ans += (int) tg[v].size();
    }
    cout << m - mx << " " << 1 << "\n";
    return 0;
}