#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <tuple>
#include <deque>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int INF = 2 * 1e9;
const ll MAX = 1e15;
const ll MIN = -1e15;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-7;

#define int long long

vector<vector<int>> g, dist;
vector<bool> used;

void dfs(int st) {
    dist[st][st] = 1;
    used[st] = true;
    deque<int> q = {st};
    while (!q.empty()) {
        int u = q.front();
        q.pop_front();
        for (int v : g[u]) {
            dist[st][v]++;
            if (!used[v]) q.push_back(v), used[v] = true;
        }
    }
}

void solve() {
    int n, m, q; cin >> n >> m >> q;
    g.assign(n, {});
    vector<pii> edge;
    int ans = 0;
    for (int i = 0; i < m; i++) {
        int u, v; cin >> u >> v;
        u--, v--;
        g[u].push_back(v);
        edge.emplace_back(u, v);
    }
    dist.assign(n, vector<int> (n, 0));
    for (int u = 0; u < n; u++) {
        used.assign(n, false);
        dfs(u);
    }

    for (auto [u, v] : edge) {
        if (dist[u][v] == 1) ans++;
    }
    cout << ans << " " << ans - 1 << endl;
}

signed main() {

    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int t = 1; //cin >> t;
    while (t--) solve();
}
