#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double dbl;
typedef vector <int> vi;
typedef vector <long long> vll;
typedef vector <string> vs;
const int inf = 1e9 + 5;
#define FAST ios::sync_with_stdio(false); cin.tie(0);
#define MAX INT_MAX
#define MIN INT_MIN
#define potato 0
#define lomljenje break

/*
#define A first
#define B second
#define PB push_back
#define MP make_pair
*/

int main()
{
    FAST

    int n, m;
    cin >> n >> m;
    for(int i = 0; i < m; ++i)
    {
        int a, b, t;
        cin >> a >> b >> t;
    }
    int u, v;
    cin >> u >> v;
    cout << -1;
    return potato;
}