#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

template<class T>
using kekset = tree<T, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;

#define int int64_t
#define endl '\n'

mt19937 rng(time(nullptr));

int randInt(int l, int r) { return uniform_int_distribution<int>(l, r)(rng); }

void solve() {
    int n, m, group;
    cin >> n >> m >> group;
    int ans = m;
    set<pair<int, int>> st;
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        ans -= (u + 1 == v && st.find({u, v}) == st.end());
        ans -= (u == n && v == 1 && st.find({u, v}) == st.end());
        st.emplace(u, v);
    }
    cout << ans << endl << 1 << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int test = 1;
    //cin >> test;

    while (test--) {
        solve();
    }

    return 0;
}