#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <unordered_set>
#include <algorithm>

using namespace std;

using ll = long long;

#pragma GCC optimaze("Ofast");

vector<unordered_set<int>> gr, grr;

vector<int> us;
vector<int> top;
vector<int> ok;
set<pair<int, int>> ed;
ll n, m, t;

void dfs(int v, vector<vector<int>>& gr, vector<vector<int>>& gr2, vector<int>& us, int& cnt) {
	us[v] = 1;
	for (int u : gr[v]) {
		if (us[u]) continue;
		if (int(gr[v].size()) == 1) {
			cnt++;
			dfs(u, gr, gr2, us, cnt);
		}
		else if (int(gr2[u].size()) == 1) {
			cnt++;
			dfs(u, gr, gr2, us, cnt);
		}
	}
	for (int u : gr2[v]) {
		if (us[u]) continue;
		if (int(gr2[v].size()) == 1) {
			cnt++;
			dfs(u, gr, gr2, us, cnt);
		}
		else if (int(gr[u].size()) == 1) {
			cnt++;
			dfs(u, gr, gr2, us, cnt);
		}
	}
}

pair<ll, ll> an(vector<vector<int>>& gr) {
	int md = 0;
	int n = int(gr.size());
	for (int i = 0; i < n; i++) md = max(md, int(gr[i].size()));
	if (md == 1) {
		return { m - 1, m - 1 };
	}
	vector<vector<int>> gr2(n);
	for (int i = 0; i < n; i++) {
		for (int u : gr[i]) gr2[u].push_back(i);
	}
	vector<int> us(n);
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if (us[i]) continue;
		dfs(i, gr, gr2, us, cnt);

	}
	return { cnt, 1 };
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> m >> t;
	gr.resize(n);
	grr.resize(n);
	us.resize(n);
	vector<pair<int, int>> e;
	vector<int> use(m);
	vector<vector<int>> gr(n);
	for (int i = 0; i < m; i++) {
		int A, B;
		cin >> A >> B;
		A--;
		B--;
		gr[A].push_back(B);
	}
	pair<int, int> ans = an(gr);
	cout << ans.first << ' ' << ans.second << "\n";
}



