#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

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

typedef tree<int, null_type,less<>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const int N = 2000+10, inf = 1e18;
vector<pair<int, int>> g[N];
int x[N], y[N];
int used[N], u[N], tim = 0, cnt = 0, ans = 0;
vector<int> vc;

void dfs(int v) {
    used[v] = tim;
    for (pair<int, int> p: g[v]) {
        if (!u[p.second] && used[p.first] != tim) {
            dfs(p.first);
        }
    } 
}



void tryerase (int j) {
    u[j] = true;
    tim++;
    dfs(x[j]);
    u[j] = false;
    if (used[y[j]] != tim) {
        ans++;
    }
}

signed main () {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m, t, u, v;
    cin >> n >> m >> t;
    for (int i = 1; i <= m; i++) {
        cin >> u >> v;
        x[i] = u; y[i] = v;
        g[u].push_back({v, i});
    }
    for (int i = 1; i <= m; i++) {
        tryerase(i);
    }
    if (ans <= n-1) {
        cout << ans << '\n' << 1;
    } else {
        cout << n-1 << '\n' << n;
    }
    return 0;
}