#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <bitset>

using namespace std;

using ll = long long;

const ll MOD = 1e9 + 7;

pair<ll, ll> solve_DAG(vector<vector<ll>> dag) {
	ll n = dag.size();
	ll cnt = 0;
	vector<pair<ll, ll>> edges;
	for (int i = 0; i < n; i++) {
		for (auto j : dag[i]) edges.push_back({ i, j });
	}
	for (auto e : edges) {
		vector<vector<ll>> dag2(n);
		for (int i = 0; i < n; i++) {
			for (auto p : dag[i]) {
				if (i == e.first && p == e.second) continue;
				dag2[p].push_back(i);
			}
		}
		vector<bool> can_get(n);
		can_get[e.first] = true;
		for (int i = e.first + 1; i <= e.second; i++) {
			for (auto p : dag2[i]) can_get[i] = can_get[i] || can_get[p];
		}
		if (can_get[e.second]) cnt++;
	}
	return { cnt, 1 };
}

pair<ll, ll> solve_component(vector<vector<ll>> graph) {
	ll cnt = 0;
	vector<ll> to(graph.size());
	for (int i = 0; i < graph.size(); i++) {
		for (auto j : graph[i]) {
			to[j]++;
		}
	}
	for (int i = 0; i < graph.size(); i++) {
		for (auto j : graph[i]) {
			if (to[j] == 1 || graph[i].size() == 1) cnt++;
		}
	}
	if (cnt == graph.size()) cnt--;
	return { cnt, 1 };
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	ll n, m, g; cin >> n >> m >> g;
	vector<vector<ll>> graph(n);
	while (m--) {
		ll a, b; cin >> a >> b; a--; b--;
		graph[a].push_back(b);
	}
	auto ans = solve_component(graph);
	cout << ans.first << " " << ans.second << endl;
}