#include<bits/stdc++.h>
using namespace std;
const int maxn=100010;
int t,n,m,k,p,head[maxn],tail[maxn],e=0,r1,r2,r3,d[maxn],df,fa[maxn];
long long f[maxn];
bool vis1[maxn],vis2[maxn],bbb;
struct edge
{
int from,to,val,next1,next2;
long long f;
}ed[maxn<<1];
struct node
{
int w,num;
inline bool operator <(const node &x)const
{
return w<x.w;
}
};
priority_queue<node> q;
inline void addedge(int x,int y,int z)
{
ed[++e].from=x;
ed[e].to=y;
ed[e].val=z;
ed[e].next1=head[x];
ed[e].next2=tail[y];
ed[e].f=0;
head[x]=e;
tail[y]=e;
}
int find(int x)
{
if(fa[x]==x)return x;
return fa[x]=find(fa[x]);
}
inline void dij()
{
memset(d,0x3f3f3f3f,sizeof(d));
q.push((node){0,1});
d[1]=0;
while(!q.empty())
{
node k=q.top();q.pop();int x=k.num;
if(vis1[x])continue;vis1[x]=1;
for(int i=head[x];i;i=ed[i].next1)
{
int y=ed[i].to;
if(d[y]>d[x]+ed[i].val)
{
d[y]=d[x]+ed[i].val;
q.push((node){d[y],y});
}
}
}
}
void dfs1(int x)
{
for(int i=tail[x];i;i=ed[i].next2)
{
int y=ed[i].from;
if(vis2[y])continue;
vis2[y]=1;
dfs1(y);
}
}
void dfs2(int x)
{
for(int i=head[x];i;i=ed[i].next1)
{
int y=ed[i].to;
}
}
inline void init()
{
memset(vis1,false,sizeof(vis1));
memset(vis2,false,sizeof(vis2));
memset(head,0,sizeof(head));
memset(tail,0,sizeof(tail));
for(int i=1;i<=e;i++)
{
ed[i].from=0;
ed[i].f=0;
ed[i].to=0;
ed[i].next1=0;
ed[i].next2=0;
ed[i].val=0;
}
e=0;
memset(f,0,sizeof(f));
scanf("%d%d%d%d",&n,&m,&k,&p);
for(int i=1;i<=m;i++)
{
scanf("%d%d%d",&r1,&r2,&r3);
addedge(r1,r2,r3);
}
for(int i=1;i<=n;i++)
fa[i]=i;
bbb=0;
}
int main()
{
printf("3\n-1");
return 0;
}