#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

#define int long long

vector<int> used;

bool f = 0;

void dfs(int v, vector<vector<int> > &g) {
    used[v] = 1;
    for (int u : g[v]) {
        if (used[u] == 1) {
            f = 1;
        }
        if (!used[u]) {
            dfs(u, g);
        }
    }
    used[v] = 2;
}

signed main() {
    cin.tie(0);
    cout.tie(0);
    int n, m, G; cin >> n >> m >> G;
    vector<pair<int, int> > es(m);
    for (int i = 0; i < m; i++) {
        int u, v; cin >> u >> v; u--; v--;
        es[i] = {u, v};
    }
    int cn = 0;
    for (int i = 0; i < m; i++) {
        used.assign(n, 0);
        vector<vector<int> > g(n, vector<int> (0));
        for (int j = 0; j < m; j++) {
            auto [u, v] = es[j];
            if (i != j) {
                g[u].push_back(v);
            } else {
                g[v].push_back(u);
            }
        }
        f = 0;
        for (int i = 0; i < n; i++) {
            if (!used[i]) {
                dfs(i, g);
            }
        }
        if (f) {
            cn++;
        }
    }
    cout << cn << " " << 1;
    return 0;
}