#include <bits/stdc++.h>
#define ff(i,a,b) for(int (i) = (a); (i) < (b); ++ (i))
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pic pair<int,char>
#define FF(i,a,b) for(int (i) = (a); (i) > (b); -- (i))
#define xx first
#define yy second
#define pb push_back
#define ll long long
#define pqq priority_queue
using namespace std;
void solve(){
	int n,m;cin>>n>>m;
	ff(i,0,m){
		int a,b,t;
		cin>>a>>b>>t;
	}
	int u,v;cin>>u>>v;
	cout<<"-1";
}
int main(){
	ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
}