#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<unordered_set>
#include<unordered_map>
#include<iomanip>
#include<random>
#include<bitset>
#include<ctime>

#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2")

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using uint = unsigned int;

ll gcd(ll a, ll b) {
	return b == 0 ? a : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
mt19937 mt(time(0));
const int N = 2000 + 2, inf = 1e9 + 100, mod = 1e9 + 7, mod2 = 998244353, P = 257;
const ll llinf = 1e18 + 100;
int n, m, gg;
vector<int> g[N];
bool used[N];
void dfs(int v, int st, int ban) {
	used[v] = true;
	for (auto to : g[v]) {
		if (v == st && to == ban) continue;
		if (!used[to]) dfs(to, st, ban);
	}
}

void solve() {
	cin >> n >> m >> gg;
	for (int i = 0; i < m; ++i) {
		int x, y;
		cin >> x >> y;
		--x, --y;
		g[x].push_back(y);
	}
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		for (auto to : g[i]) {
			fill(used, used + n, false);
			dfs(i, i, to);
			if (!used[to]) ++ans;
		}
	}
	if (ans == 0) {
		cout << 0 << ' ' << 1;
	}
	else {
		cout << ans - 1 << ' ' << ans;
	}
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int tt = 1;
	//cin >> tt;
	while (tt--) {
		solve();
		cout << '\n';
		cout.flush();
	}
	return 0;
}