#include<bits/stdc++.h>

using namespace std;

const int MAX = 2e3 + 1, MOD = 1e9 + 7;
vector<int> g[MAX], gt[MAX];
int used[MAX], usedc[MAX];
vector<int> top_sort;

void dfs(int v) {
    used[v] = 1;
    for (int to : g[v]) {
        if (!used[to]) {
            dfs(to);
        }
    }
    top_sort.push_back(v);
}

vector<int> cn[MAX];

void dfs2(int v, int num) {
    usedc[v] = num;
    cn[num].push_back(v);
    for (int to : gt[v]) {
        if (!usedc[to]) {
            dfs2(to, num);
        }
    }
}

int sl[MAX];
int used3[MAX];

void dfs3(int v) {
    used3[v] = 1;
    sl[v]++;
    for (int to : g[v]) {
        if (!used3[to]) {
            dfs3(to);
        }
    }
}

signed main() {
    int n, m, _;
    cin >> n >> m >> _;
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        --u; --v;
        g[u].push_back(v);
        gt[v].push_back(v);
    }
    for (int i = 0; i < n; ++i) {
        if (!used[i]) {
            dfs(i);
        }
    }
    reverse(top_sort.begin(), top_sort.end());
    int num = 0;
    for (int i = 0; i < n; ++i) {
        int v = top_sort[i];
        if (!usedc[v]) {
            num++;
            dfs2(v, num);
        }
    }
    vector<pair<int, int>> dp(n + 1);
    dp.back() = {0, 1};
    for (int i = n - 1; i >= 0; --i) {
        int v = top_sort[i];
        int mn = n + 2;
        for (int to : g[v]) {
            mn = min(mn, sl[to]);
            //cout << to << " " << sl[to] << endl;
        }
        int cnt = 0;
        for (int to : g[v]) {
            if (sl[to] == mn) {
                cnt++;
            }
        }
        dp[i] = dp[i + 1];
        dp[i].first += max(0, (int)g[v].size() - 1);
        fill(used3, used3 + n, 0);
        dfs3(v);
    }
    cout << dp[0].first << " " << dp[1].second << endl;
    return 0;
}
