// semenInRussia 2025
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#define nl '\n'

const int N = 2005;
vector<int> g[N];

const int mod = 1e9 + 7;

int pow(int x, int k) {
  int ans = 1;
  while (k) {
    if (k & 1) {
      ans = 1ll * ans * x % mod;
    }
    x = 1ll * x * x % mod;
    k >>= 1;
  }
  return ans;
}

int main() {
  int n, m, tg;
  cin >> n >> m >> tg;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    g[x].push_back(y);
  }
  // pow(2, m)
  // int ans = (pow(2, n) - 1 + mod) % mod;
  int ans = -1;
  cout << m - 1 << " " << ans;
}