rt,码风不好请见谅
#include <bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
int n,m,q,fa[maxn];
bool vis[maxn][2];
vector<int> g[maxn];
int getfa(int x)
{
if(fa[x]==x) return x;
return fa[x]=getfa(fa[x]);
}
void dfs(int u,int w)
{
vis[u][w]=true;
for(int i=0;i<g[u].size();i++)
{
if(!vis[g[u][i]][w^1]) dfs(g[u][i],w^1);
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
cin>>n>>m>>q;
for(int i=1;i<=n;i++) fa[i]=i;
for(int i=1;i<=m;i++)
{
int u,v;
cin>>u>>v;
g[u].push_back(v);
g[v].push_back(u);
fa[getfa(u)]=getfa(v);
}
for(int i=1;i<=n;i++)
{
if(!vis[i][0]&&!vis[i][1]) dfs(i,0);
}
while(q--)
{
int s,t,x;
cin>>s>>t>>x;
if(getfa(s)==getfa(t)&&(((x&1)==1&&(vis[s][1]&&vis[t][0]||vis[s][0]&&vis[t][1]))||((x&1)==0&&(vis[s][1]&&vis[t][1]||vis[s][0]&&vis[t][0]))))
{
//cout<<vis[t][1]<<" ";
cout<<"tribool\n";
}
else cout<<"expand\n";
}
return 0;
}