#include <iostream>
using namespace std;


int main()
{
    long long n, m;
        cin >> n >> m;
            
                for (int i = 0; i < m; i++)
                        cin >> n >> n >> n;
                                
                                    cin >> n >> n;
                                        cout << -1;
                                            return 0;
                                            }