#include using namespace std; typedef long long ll; const int maxn = 100000+5; const int INF = 0x3f3f3f3f; const int mod = 1e9+7; struct Eage { int u,v; }eage[maxn]; int du1[maxn]; int du2[maxn]; int main() { //freopen("in","r",stdin); //freopen("out","w",stdout); int t;cin>>t; while(t--) { int n,m,k; cin>>n>>m>>k; memset(du1,0,sizeof du1); memset(du2,0,sizeof du2); for(int i=0;i