#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
struct node{
	int u,v,next;
	LL w;
};
node edge[65536];
LL dist[1024];
int first[1024];
int prev[1024];
int n,m;
int sum;
LL c;
void add(int u,int v,LL cost){
	edge[++sum].u=u,edge[sum].v=v,edge[sum].w=cost;
	edge[sum].next=first[u],first[u]=sum;
	edge[++sum].u=v,edge[sum].v=u,edge[sum].w=cost;
	edge[sum].next=first[v],first[v]=sum;
}
bool vis[1024];
int sav[1024],ans;
inline bool cmp(int x,int y){
	return x<y;
}
void spfa(){
	queue<int>Q;
	for(int i=2;i<=n;i++)
		dist[i]=(1ll<<62);
	Q.push(1),dist[1]=0,vis[1]=true;
	int head,k;
	while(Q.size()){
		head=Q.front();
		Q.pop();
		vis[head]=false;
		k=first[head];
		while(k){
			int v=edge[k].v;
			if(dist[head]+edge[k].w<dist[v]){
				dist[v]=dist[head]+edge[k].w;
				prev[v]=k;
				if(!vis[v]){
					vis[v]=true;
					Q.push(v);
				}
			}
			k=edge[k].next;
		}
	}
	if(dist[n]>=c)
		puts("Fair");
	else{
		puts("Unfair");
		ans=0;
		int ind=n;
		while(ind!=1){
			sav[++ans]=(prev[ind]+1)/2;
			ind=edge[ prev[ind] ].u;
		}
		sort(sav+1,sav+ans+1,cmp);
		printf("%d\n",ans);
		printf("%d",sav[1]);
		for(int i=2;i<=ans;i++)
			printf(" %d",sav[i]);
		puts("");
	}
	return ;
}
int main(){
	freopen("gas.in","r",stdin);
	freopen("gas.out","w",stdout);
	scanf("%d%d%I64d",&n,&m,&c);
	int u,v;
	LL cost;
	sum=0;
	memset(first,0,sizeof(first));
	memset(prev,0,sizeof(prev));
	for(int i=1;i<=m;i++){
		scanf("%d%d%I64d",&u,&v,&cost);
		add(u,v,cost);
	}
	spfa();
	fclose(stdin);
	fclose(stdout);
	return 0;
}

