#ifndef LOCAL
  #pragma GCC optimize("Ofast,unroll-loops")
#endif
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#ifndef LOCAL
  #pragma GCC target("avx,avx2,fma")
#endif

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define all(x) begin(x), end(x)
#define isz(x) (int)size(x)

void solve() {
  int n, m, num_group;
  cin >> n >> m >> num_group;
  vector<bool> use1(n + 1), use2(n + 1);
  int cnt = 0;
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    if (u + 1 == v) use1[u] = 1;
    if (u + 2 == v) use2[u] = 1;
  }
  int cnt = 0;
  for (int i = 1; i <= n; ++i) {
    cnt += use1[i] && use2[i];
    cnt += use1[i];
  }
  cout << m - cnt << " 1\n";
}

signed main() {
  cin.tie(0)->sync_with_stdio(0);
  int t = 1;
  // cin >> t;
  for (int i = 0; i < t; ++i) {
    solve();
  }
}