#pragma GNU optimize("O3")
#pragma GNU optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;
#define pb push_back
#define in insert
#define int long long
#define ll long long
#define inf 1000000000000000000
#define N 2000
#define de 1000000007
int cnt = 0;
int used[N];
vector<int> gr[N], grm[N];

void DFS(int v){
    if(used[v]) return;
    used[v] = 1;
    for(int u: grm[v])
        DFS(u);
}

void DFS1(int v){
    if(used[v]) return;
    used[v] = 1;
    for(int u: grm[v])
        DFS1(u);
    for(int u: gr[v]){
        if(used[u]) continue;
        grm[v].pb(u);
        cnt++;
        DFS1(u);
    }
}

void tup(){
    int n, m, g; cin >> n >> m >> g;
    for(int i = 0; i < m; i++){
        int u, v; cin >> u >> v; u--, v--;
    }
    for(int i = 0; i < n; i++)
        sort(gr[i].begin(), gr[i].end());
    for(int i = 0; i < n; i++){
        for(int &j: used) j = 0;
        DFS(i); DFS1(i);
    }
    cout << m - cnt;
    cout << 1;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    tup();
}
