#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <unordered_map>
#include <random>

#define all(v) v.begin(), v.end()
#define len(v) (int)v.size()
#define coutd cout << fixed << setprecision(20)

using namespace std;
using ll = long long;
using ld = long double;

const ll Mod = 1e9 + 7;

vector<vector<int>> g;
vector<vector<int>> rg;

int cnt = 0;
vector<int> red;
int n, m;

int main()
{
    cin.tie(0)->sync_with_stdio(0);
    int group;
    cin >> n >> m >> group;
    g.resize(n);
    red.resize(n);
    rg.resize(n);
    for (int i = 0; i < m; ++i)
    {
        int v, u;
        cin >> v >> u;
        --v;
        --u;
        g[v].push_back(u);
        rg[u].push_back(v);
    }
    cout << n << ' ' << -1;

    return 0;
}
