#include <string>
#include <bitset>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>

using namespace std;
using ll = long long;
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()

// #define SUBMIT

#ifdef SUBMIT
    #pragma GCC optimize("Ofast,unroll-loops")
#endif

void fast() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    cout << setprecision(8) << fixed;
}

ll mod = 1e9 + 7;
ll binpow(ll a, ll n) {
    ll res = 1;
    for (int i = 0; (1ll << i) <= n; ++i, a = a * a % mod) {
        if ((n >> i) & 1) res = res * a % mod;
    }
    return res;
}

vector<bool> used;
vector<vector<int>> g;
void dfs(int v) {
    used[v] = true;
    for (auto u : g[v]) {
        if (used[u]) continue;
        dfs(u);
    }
}
ll INF = 1e18;
void solve() {
    int n, m, _;
    cin >> n >> m >> _;
    vector<pair<int, int>> es(m);
    g.resize(n);
    for (int i = 0; i < m; ++i) {
        int v, u;
        cin >> v >> u;
        --v, --u;
        g[v].push_back(u);
        es[i] = make_pair(v, u);
    }
    used.resize(n);
    int ans = n;
    for (int i = 0; i < n; ++i) {
        if (used[i]) continue;
        ans--;
        dfs(i);
    }
    cout << m - ans << '\n';
    cout << 1 << '\n';
} 

int main() {
    fast();
    int t = 1;
    // cin >> t;
    while (t--) solve();
    return 0;
}