#include <bits/stdc++.h>
#define int long long
using namespace std;
vector<vector<int>> gr;
vector<int> vst;
vector<int> tp;
void dfs(int v) {
    vst[v] = 1;
    for (auto x : gr[v]) {
        if (!vst[x]) dfs(x);
    }
    tp.push_back(v);
}
const int N = 2001;
int p[N];
int h[N];
int get(int v) {
    if (v == p[v]) return v;
    return p[v] = get(p[v]);
}
void unite(int u, int v) {
    if (h[u] < h[v]) swap(u, v);
    h[u] = max(h[u], h[v] + 1);
    p[v] = u;
}
signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, m, g; cin >> n >> m >> g;
    for (int i = 0; i < n; i++) {
        p[i] = i;
        h[i] = 1;
    }
    gr.resize(n); vst.resize(n);
    vector<int> deg(n);
    int cnt = 0;

    for (int i = 0; i < m; i++) {
        int u, v; cin >> u >>v;
        u--; v--;
        gr[u].push_back(v);
        if (get(u) != get(v)) {
            cnt++;
        }
    }
    cout << m - cnt << '\n';
    cout << 239 << '\n';
    return 0;
}
