#include #define endl '\n' #define fi first #define se second using namespace std; void fileIO() { freopen("fart.in", "r", stdin); freopen("fart.out", "w", stdout); } void fastIO() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } const int MAXN=105; const int MAXK=20; int n,m,k; int a[MAXN]; vector > adj[MAXN]; bool used[MAXN]; bool vis[MAXN]; bool fl=0; int cur=0; void dfs(int v,int mask) { used[v]=1; if(v==n) { fl=1; return; } vis[v]=1; cur|=(a[v]&mask); for(int i=0;i>n>>m>>k; for(int i=1;i<=n;i++) { string s; cin>>s; a[i]=0; for(int j=0;j>u>>v>>s; int cur=0; for(int j=0;j=ans) continue; //cout<