#include #include #include #define maxn 1010 #define maxk 1000010 #define lowbit(x) (x)&(-x) int c[maxn],kas,n,m,k; using namespace std; typedef long long LL; struct Edge { int x, y; }e[maxk]; bool cmp(Edge a,Edge b) { return a.x0) { s+=c[i]; i-=lowbit(i); } return s; } int main() { int T; scanf("%d",&T); while (T--) { memset(c,0,sizeof(c)); scanf("%d%d%d",&n,&m,&k); for(int i=0;i