#include <iostream>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <assert.h>
using namespace std;

//#define int long long
#define ll long long
#define vi vector<int>
#define pi pair<int, int>
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define vpi vector<pi>
#define vvi vector<vi>

vi used;
vvi graph;
int ans = 0;
void dfs(int u) {
	used[u] = 1;
	for (int v : graph[u]) {
		if (used[v]) {
			ans++;
			continue;
		}
		dfs(v);
	}
}

signed main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);


	int n, m, g;
	cin >> n >> m >> g;
	graph.assign(n, vi());
	used.assign(n, 0);
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		graph[u - 1].push_back(v - 1);
	}
	for (int i = 0; i < n; i++) {
		if (!used[i]) dfs(i);
	}
	cout << ans << endl;
	cout << 1 << endl;
}
