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

using namespace std;
using namespace __gnu_pbds;

#define int long long
#define endl "\n"
#define ff first
#define ss second
#define ordered_set tree<int, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>
#define all(x) x.begin(), x.end()

const int INF = 1e18;


void solve() {

    int n, m, tgg;
    cin >> n >> m >> tgg;

    vector<pair<int, int>> otr;

    vector<pair<int, int>> g;

    vector<pair<int, int>> sl;

    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        if (x > y) {
            otr.push_back({y, x});
            sl.push_back({x, -1});
            sl.push_back({x, 1});
        } else {
            g.push_back({x, y});
        }
    }

    for (int i = 0; i < n; i++) {
        sl.push_back({i, 0});
    }

    int bal = 0;

    sort(all(sl));

    vector<int> comp(n, -1);

    int comp_num = 0;


    for (auto [c, tp]: sl) {
        if (tp == 0) {
            comp[c] = comp_num;
        } else if (tp == 1) {
            bal--;
            if (bal == 0) {
                comp_num++;
            }
        } else {
            bal++;
        }
    }

    int ans = 0;

    for (auto [x, y]: g) {
        if (comp[x] != comp[y] && x + 1 != y) {
            ans++;
        }
    }

    vector<set<int>> cover(n);

    int ind = 0;

    for (auto [x, y]: otr) {
        for (int i = x; i <= y; i++) {
            cover[i].insert(ind);
        }
        ind++;
    }

    set<int> st;

    for (int i = 0; i < n; i++) {
        if (cover[i].size() == 1) {
            st.insert(*(cover[i].begin()));
        }
    }

    ans += (int) st.size();

    cout << ans << " " << 1 << endl;

}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int TN;
    TN = 1;
//    cin >> TN;

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

}
