#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("02")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define int long long
const int N = 2000 + 3;
vector<int> g[N];
vector<int> now[N];
bool used[N];
void dfs(int v){
    used[v] =true;
    for (auto to : now[v]){
        if (!used[to]){
            dfs(to);
        }
    }
}
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m, gg;
    cin >> n >> m >> gg;
    for (int i = 0 ;i < m; i++){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
    }
    for (int i = 0; i < n; i++){
        sort(g[i].begin(), g[i].end());
    }
    int cnt = 0;
    for (int i = n - 1; i >= 0; i--){
        fill(used, used + n, false);
        dfs(i);
        for (auto to : g[i]){
            if (!used[to]){
                now[i].push_back(to);
                now[to].push_back(i);
                cnt++;
            }
        }
    }
    cout << m - cnt << "\n" << 1;

}
/*
6 6
1 1 1 4 5
2 3 4 5 6 1
1 2 3 4 5 6

 */