#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for (int i=s;i<=t;i++)
#define pi acos(-1)
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef pair<PII, PII> PPP;
typedef pair<PII, int> PPI;
#define repp(i,s,t) for (int i=s;i>=t;i--)
template<class T> T sqr(T x) {return x*x;}
#define debug(x) cerr<<#x"="<<(x)<<endl;
#define pb(x) push_back(x);
#define ori(x) x-'a'
PII edge[1001];
struct Gao{
	int head, tail;
	int q[20];
	int now, to[2];
	int sz;
	Gao()
	{
		head = tail = 0;
		now = 0;
		sz = 0;
	}
	void push_back(int x)
	{
		q[tail] = x;		
		tail = (tail + 1) % 18;
		sz++;
	}
	void pop_front()
	{
		head = (head + 1) % 18;
		sz--;
	}
	void set_to(int u, int v)
	{
		to[0] = u;
		to[1] = v;
	}		
	bool crash(int x)
	{
		for (int i = head; i != tail; i = (i + 1) % 18)
			if (q[i] == x) return true;
		return false;
	}
};
bool operator < (const Gao &x, const Gao &y)
{
	int i = x.head, j = y.head;
	for (i = x.head, j = y.head; i != x.tail && j != y.tail; i = (i + 1) % 18, j = (j + 1) % 18)
	{
		if (x.q[i] < y.q[j]) return true;
		else if (x.q[i] > y.q[j]) return false;
	}
	if (j != y.tail) return true;
	return false;
}
int n,m,k;
int g[1001][3];
int x, y, z;
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	int toplen = (k - 1) / 40 + 1;
	Gao t1, t2;
	map<Gao, int> dist;
	queue<Gao> Q;
	dist[t1] = 2;
	rep(i,1,m)
	{
		scanf("%d%d%d",&x,&y,&z);
		rep(j,0,z-1) scanf("%d",&g[i][j]);
		edge[i] = PII(x, y);
	}
	int one = 1;
	rep(i,1,m)
	if (edge[i].first == 1)
	{
		if (edge[i].second == n)
		{
			cout << 1ll * 1000 + k * 25 << endl;
			return 0;
		}
		Gao tem;
		tem.push_back(one);
		tem.push_back(edge[i].second);
		tem.set_to(g[i][0], g[i][1]);
		Q.push(tem);
		dist[tem] = 1;	
	}
	int ans = -1;
	while (!Q.empty())
	{
		Gao tem = Q.front();
		Q.pop();
		int dis = dist[tem];
		rep(j,0,1)
		{
			Gao nexts = tem;			
			int t = tem.to[j];
			if (!t) continue;
			int v = edge[t].second;
			if (nexts.sz + 1> toplen) nexts.pop_front();
			if (!nexts.crash(v))
			{			
				nexts.push_back(v);
				nexts.set_to(g[t][0], g[t][1]);
				if (dist.find(nexts) == dist.end())
				{
					dist[nexts] = dis + 1;
					Q.push(nexts);
				}
				if (v == n)
				{
					ans = dis + 1;
					break;
				}
			}
		}
		if (ans != -1) break;
	}
	if (ans == -1) puts("No chance");
	else
	{
		LL ret = ans;
		cout << ret * 1000 + k * 25 << endl;
	}
	
}
