#include <bits/stdc++.h>
#define ll long long
using namespace std;
vector<vector<pair<int,int>>> g;
vector<vector<pair<int,int>>> gr;
vector<bool> used;
vector<int> topsort;
void dfs(int v,int avoid) {
    used[v] = true;
    for (auto [to,num]:g[v]) {
        if (!used[to] and num!=avoid) {
            dfs(to,avoid);
        }
    }
    topsort.push_back(v);
}
void dfs2(int v,int avoid) {
    used[v] = true;
    for (auto [to,num]:gr[v]) {
        if (!used[to] and num!=avoid) {
            dfs2(to,avoid);
        }
    }
}
int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n,m,gg;
    cin >> n >> m >> gg;
    g.resize(n);
    gr.resize(n);
    used.resize(n);
    for (int i = 0;i < m;i++) {
        int a,b;
        cin >> a >> b;
        g[a-1].push_back({b-1,i});
        gr[b-1].push_back({a-1,i});
    }
    ll ans = 0;
    for (int i = 0;i < m;i++) {
        topsort.clear();
        used.assign(n,0);
        for (int j = 0;j < n;j++) {
            if (!used[j]) {
                dfs(j,i);
            }
        }
        reverse(topsort.begin(),topsort.end());
        int cnt = 0;
        used.assign(n,0);
        for (int j = 0;j < n;j++) {
            if (!used[topsort[j]]) {
                cnt++;
                dfs2(topsort[j],i);
            }
        }
        if (cnt>1) {
            ans++;
        }
    }
    cout << ans-1 << ' ' << n << '\n';
    return 0;
}
