#include "bits/stdc++.h"
#include "numeric"
using namespace std;

#define forn(i, n) for(int i=0;i<n;++i)
#define fornn(i, l, r) for(int i=l;i<=r;++i)
#define ford(i, n) for(int i=n-1;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int maxn = 1e5 + 7;
const int logn = 32;
const int mod = 1e9 + 7;
const int iterations = 5e5;

int n,m, test;
vector<vector<int>> g;
vector<map<int, pii>> gr;
vector<int> used;
vector<int> component;

bool dfs(int v, int clr) {
    bool res=false;
    used[v]=clr;

    for(auto i:g[v]) {
        if (component[i]==-1 && used[i]!=clr) {
            res=res | dfs(i,clr);
        } else if (component[i]==clr) res=true;
    }

    if (res) component[v]=clr;
    return res;
}

bool find(int v, int timer) {
    bool res=false;
    used[v]=timer;

    for(auto i:gr[v]) {
        if (i.ss.ss == 0) continue;
        if (used[i.ff]==timer) return true;
        res = res || find(i.ff, timer);
    }

    return res;
}

void solve() {
    cin>>n>>m>>test;
    g.assign(n,{});
    forn(i,m) {
        int a,b; cin>>a>>b;
        a--; b--;
        g[a].pb(b);
    }

    component.assign(n, -1);
    used.assign(n, -1);
    int comp=0;
    forn(i,n) {
        if (component[i]==-1) {
            component[i]=comp++;
            dfs(i,component[i]);
        }
    }

    vector<int> count(comp);
    for(auto i:component) count[i]++;

    int res=0;
    int res_count=1;
    for(auto i:count) res+=i-1;

    gr.assign(comp, {});
    forn(v,n) {
        for(auto i:g[v]) {
            if (component[i]!=component[v]) {
                int a=component[v];
                int b=component[i];
                gr[a][b].ff++;
                gr[a][b].ss=1;
                gr[b][a].ss=0;
            }
        }
    }

    int timer=0;
    used.assign(comp, -1);
    forn(v,comp) {
        for(auto i:gr[v]) {
            if (i.ss.ss==0) continue;
            res += i.ss.ff - 1;
            // reverse edge
            gr[i.ff][v].ss=1;
            gr[v][i.ff].ss=0;
            // find cycle
            bool found = find(v, timer);
            // make edge back
            gr[i.ff][v].ss=0;
            gr[v][i.ff].ss=1;
            // check if cycle exist, then add answer and break
            if (found) {
                res++;
            }
            // adding timer to the next iteration of cycle finding
            timer++;
        }
    }

    cout<<res<<" "<<1;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

#ifdef LOCAL
    freopen("C:\\work\\untitled\\b.txt", "r", stdin);
    freopen("C:\\work\\untitled\\out.txt", "w", stdout);

    while (!cin.eof()) {
        solve();
        cout << endl;
    }
#else
        solve();
#endif

    return 0;
}
