#include #include #include #include #include #include #include #include #include #include #include #include #define X first #define Y second #define clr(u,v); memset(u,v,sizeof(u)); #define in() freopen("data","r",stdin); #define out() freopen("ans","w",stdout); #define Clear(Q); while (!Q.empty()) Q.pop(); #define pb push_back using namespace std; typedef long long ll; typedef pair pii; typedef pair psi; const int maxn = 2e5 + 10; const int INF = 0x3f3f3f3f; pii P[maxn]; ll cnt[maxn]; int main() { #ifdef LOCAL in(); #endif int T; scanf("%d",&T); while (T--) { int n,m,k; scanf("%d%d%d",&n,&m,&k); clr(cnt,0); for (int i=0;i