#include <bits/stdc++.h>
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define endl '\n'
typedef long long ll;
using namespace std;

const int MOD = 1e9 + 7;
const int N = 2e3 + 5;
vector<int> g[N], g2[N];
int u[N];

int dfs(int v) {
    int k = 0;
    u[v] = 1;
    for (auto to : g[v]) {
        if (!u[to]) {
            k += dfs(to) + 1;
        }
    }

    u[v] = 2;
    return k;
}

void solve() {
    int n, m, gr;
    cin >> n >> m >> gr;

    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;

        g[x].push_back(y);
        g2[x].push_back(y);
    }

    int k = 0, ans = 0;
    for (int i = 0; i < n; i++) {
        if (g[i].size() == 1 || g2[i].size() == 1) k++;
    }

    cout << k / 2 << " " << -1 << endl;
}

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

    solve();
}
