#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
    int n, m, g;
    cin >> n >> m >> g;

    vector<vector<int>> gr(n);
    for (int i = 0; i < m; i++) {
        int v, u;
        cin >> v >> u;
        v--;
        u--;

        gr[v].push_back(u);
    }

    cout << 3 << '\n';
    cout << -1 << '\n';
}