//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast,unroll-loops")
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <iomanip>
#include <numeric>
#include <algorithm>
#include <random>
using ll = long long;
#define int ll
#define all(a) a.begin(), a.end()

using namespace std;
//using namespace __gnu_pbds;

//using odered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rnd(0);

vector<int> par;

int find(int v) {
	return par[v] == v ? v : par[v] = find(par[v]);
}

void unite(int u, int v) {
	u = find(u);
	v = find(v);
	par[u] = v;
}

void solve() {
	int n, m, g;
	cin >> n >> m >> g;
	par.resize(n);
	iota(all(par), 0);
	int ans = 0;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		if (u >= v) throw;
		u--; v--;
		if (find(u) != find(v)) {
			unite(u, v);
			ans++;
		}
	}
	cout << m - ans << ' ' << 0;
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#ifdef LOCAL
	auto f1 = freopen("input.txt", "r", stdin);
	auto f2 = freopen("output.txt", "w", stdout);
#endif

	int t;
	t = 1;// cin >> t;
	while (t--) {
		solve();
	}
}