#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int long long
#define endl "\n"
#define ff first
#define ss second
#define ordered_set tree<int, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>
#define all(x) x.begin(), x.end()

const int INF = 1e18;

vector<vector<int>> g;
vector<int> used;
vector<int> dmn;

int start;

void dfs(int v) {
    for (auto u: g[v]) {
        if (used[u]) {
            continue;
        }
        if (v != start) {
            dmn[u] = 1;
        }
        used[u] = 1;
        dfs(u);
    }
}

void solve() {

    int n, m, tgg;
    cin >> n >> m >> tgg;

    g.resize(n);

    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        g[x].push_back(y);
    }

    int ans = 0;

    for (int i = 0; i < n; i++) {
        used = {};
        used.resize(n, 0);
        dmn = {};
        dmn.resize(n, 0);
        start = i;
        dfs(i);
        for (auto u: g[i]) {
            ans += dmn[u];
        }
    }

    cout << ans << " " << 1 << endl;

}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int TN;
    TN = 1;
//    cin >> TN;

    while (TN--) {
        solve();
    }

}
