#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
vector<vector<int>>g;
vector<vector<int>>grev;

vector<int>topsort;
vector<bool>used;
void dfs_topsort(int v, vector<vector<int>>&g, vector<int>&topsort) {
    used[v] = 1;
    for (int u : g[v]) {
        if (!used[u]) dfs_topsort(u, g, topsort);
    }
    topsort.push_back(v);
}

vector<int>color;
void dfs_color(int v, int col, vector<vector<int>>&grev) {
    color[v] = col;
    for (int u : grev[v]) {
        if (color[u] == -1) {
            dfs_color(u, col, grev);
        }
    }
}

int main() {
    int n, m, kkk;
    cin >> n >> m >> kkk;
    g.resize(n);
    grev.resize(n);
    used.resize(n);
    color.resize(n, -1);
    vector<pair<int, int>>edges;
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        --u; --v;
        edges.push_back({ u, v });
        g[u].push_back(v);
        grev[v].push_back(u);
    }
    cout << m - 1 << ' ' << m << "\n";
    /*for (int i = 0; i < n; ++i) {
        if (!used[i])dfs_topsort(i, g, topsort);
    }
    reverse(topsort.begin(), topsort.end());
    int cur = 0;
    for (int x : topsort) {
        if (color[x] == -1) {
            dfs_color(x, cur++, grev);
        }
    }
    set<set<int>>temp;
    vector<set<int>>sz(cur);
    for (int i = 0; i < n; ++i) {
        sz[color[i]].insert(i);
    }
    for (int i = 0; i < n; ++i) {
        if (!sz[i].empty()) temp.insert(sz[i]);
    }
    int res = 0;
    int res2 = 0;
    for (int mask = 0; mask < (1 << m); ++mask) {
        
    }*/


}