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

using namespace std;
//using namespace __gnu_pbds;

ll n, m, ghsdf, sum;
vector<bool> used, mask, can;
vector<vector<ll>> g, revg;
vector<pair<ll, ll>> a;
vector<ll> comp, tekk, topp, kk;

void dfs(ll u) {
    used[u] = true;
    for (ll i = 0; i < g[u].size(); i++) {
        if (!used[g[u][i]]) {
            dfs(g[u][i]);
        }
    }
    topp.push_back(u);
}

void dfs2(ll u, ll cn) {
    kk.back()++;
    tekk[u] = cn;
    for (ll i = 0; i < revg[u].size(); i++) {
        if (tekk[revg[u][i]] == -1) {
            dfs2(revg[u][i], cn);
        }
    }
}

bool dfs3(ll u, ll cn) {
    sum++;
    //cout << u << " " << cn << endl;
    used[u] = true;
    bool fl = (comp[u] == cn);
    for (ll i = 0; i < revg[u].size(); i++) {
        if (!used[revg[u][i]]) {
            fl = (fl & dfs3(revg[u][i], cn));
        }
    }
    return fl;
}

bool isit() {
    //cout << "st" << endl;
    used.assign(n, 0);
    topp = {};
    for (ll i = 0; i < n; i++) {
        if (!used[i]) {
            dfs(i);
        }
    }
    ll cn = 0;
    used.assign(n, false);
    for (ll i = n - 1; i > -1; i--) {
        if (!used[topp[i]]) {
            sum = 0;
            if (!dfs3(topp[i], comp[topp[i]]) || sum != kk[comp[topp[i]]]) {
                return false;
            }
            cn++;
        }
    }
    //cout << "fin" << endl;
    return true;
}

void find_comps() {
    revg.clear();
    revg.resize(n);
    for (ll i = 0; i < g.size(); i++) {
        for (ll j = 0; j < g[i].size(); j++) {
            revg[g[i][j]].push_back(i);
        }
    }
    used.assign(n, 0);
    topp = {};
    for (ll i = 0; i < n; i++) {
        if (!used[i]) {
            dfs(i);
        }
    }
    ll cn = 0;
    tekk.assign(n, -1);
    kk = {};
    for (ll i = n - 1; i > -1; i--) {
        if (tekk[topp[i]] == -1) {
            kk.push_back(0);
            dfs2(topp[i], cn);
            cn++;
        }
    }
}

void rec(ll ind) {
    if (ind == m) {
        g.clear();
        g.resize(n);
        revg.clear();
        revg.resize(n);
        for (ll i = 0; i < m; i++) {
            if (!mask[i]) {
                g[a[i].first].push_back(a[i].second);
                revg[a[i].second].push_back(a[i].first);
            } else {
                g[a[i].second].push_back(a[i].first);
                revg[a[i].first].push_back(a[i].second);
            }
        }
        if (isit()) {
            ll r = 0;
            for (ll i = 0; i < m; i++) {
                if (mask[i] == 1) {
                    r += (1 << i);
                }
            }
            can[r] = true;
        }
        return;
    }
    mask[ind] = 0;
    rec(ind + 1);
    mask[ind] = 1;
    rec(ind + 1);
}

void input() {
    cin >> n >> m >> ghsdf;
    a.resize(m);
    for (ll i = 0; i < m; i++) {
        cin >> a[i].first >> a[i].second;
        a[i].first--;
        a[i].second--;
    }
}

void solve() {
    g.resize(n);
    can.assign((1 << m), 0);
    for (ll i = 0; i < m; i++) {
        g[a[i].first].push_back(a[i].second);
    }
    find_comps();
    comp = tekk;
    mask.resize(m);
    rec(0);
    ll ans = 0, cnt = 1;
    vector<ll> dp(1 << m);
    dp[0] = 1;
    for (ll i = 1; i < (1 << m); i++) {
        bool fl = !can[i];
        ll r = 0;
        for (ll j = 0; j < m; j++) {
            if (i & (1 << j)) {
                r++;
                fl &= dp[i ^ (1 << j)];
            }
        }
        dp[i] = fl;//
        if (fl) {//sf
            if (r > ans) {
                ans = r;
                cnt = 1;
            } else if (r == ans) {
                cnt++;
            }
        }
    }
    cout << ans << "\n" << cnt;
}

void output() {

}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    input();
    solve();
    output();
    return 0;
}
