#pragma GCC optimize('Ofast')
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int long long
using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;
struct fenw {
    vector<int> f;
    explicit fenw(int n) {
        f.resize(n);
    }
    void upd(int i, int x) {
        while (i < f.size()) {
            f[i] += x;
            i |= (i + 1);
        }
    }
    int get(int i) {
        int sum = 0;
        while (i >= 0) {
            sum += f[i];
            i %= (i + 1);
            i--;
        }
        return sum;
    }
};
template <typename T>
bool smin(T& a, T b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool smax(T& a, T b) {
    if (b > a) {
        a = b;
        return true;
    }
    return false;
}
vector<vector<pair<int, int>>> g;
vector<int> used;
int ban = -1;
int cnt = 0;
void dfs(int v) {
    used[v] = 1;
    for (auto [e, i] : g[v]) {
        if (used[e] == 0 && i != ban) {
            dfs(e);
        }
    }
    used[v] = 2;
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m, _;
    cin >> n >> m >> _;
    g.resize(n);
    used.assign(n, 0);
    vector<pair<int, int>> r;
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v, u--, v--;
        g[u].emplace_back(v, i);
        r.emplace_back(u, v);
    }
    for (int i = 0; i < m; i++) {
        ban = i;
        used.assign(n, 0);
        dfs(r[i].first);
        if (used[r[i].second]) {
            cnt++;
        }
    }
    cout << cnt << ' ' << 1 << '\n';
    return 0;
}