#include <iostream>

using namespace std;

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

    return 0;
}