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

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;

#define all(a) a.begin(), a.end()

using ordered_set = tree<int, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;

void solve();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifdef _GLIBCXX_DEBUG
    freopen("input", "r", stdin);
#endif
    int t = 1;
    //cin >> t;
    while (t--)
        solve();
}

const ll MOD = 1e9 + 7;

void solve() {
    int n, m, G;
    cin >> n >> m >> G;
    vector<vector<int>> g(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        if (a + 1 != b)
            g[b].push_back(a);
    }
    vector<int> up(n + 1, 1e9);
    int cnt = 0;
//    for (int i = n - 1; i >= 0; i--) {
//        for (int j: g[i])
//            up[i] = min(up[i], j);
//        if (i + 1 != n && up[i + 1] < i)
//            cnt++;
//    }
    cout << cnt + m - n + 1 << " 1\n";
}