#include using namespace std; const int maxn=510; const int inf=0x3f3f3f3f; int n,m,s,k,v[maxn],mat[maxn][maxn],dis[maxn]; bool vis[maxn]; int Stoer_Wagner(int n){ int i, j; int res = inf; for (i = 0; i < n; i++) v[i] = i+1; while (n > 1){ int maxp = 1,prev = 0; for (i = 1; i < n; i++) { dis[v[i]] = mat[v[0]][v[i]]; if (dis[v[i]] > dis[v[maxp]]) maxp = i; } memset(vis, 0, sizeof(vis)); vis[v[0]] = true; for (i = 1; i < n; i++){ if (i == n - 1) { res = min(res,dis[v[maxp]]); for (j = 0; j < n; j++) { mat[v[prev]][v[j]] += mat[v[j]][v[maxp]]; mat[v[j]][v[prev]] = mat[v[prev]][v[j]]; } v[maxp] = v[--n]; } vis[v[maxp]] = true; prev = maxp; maxp = -1; for (j = 1; j < n; j++) if (!vis[v[j]]){ dis[v[j]] += mat[v[prev]][v[j]]; if (maxp == -1 || dis[v[maxp]] < dis[v[j]]) maxp = j; } } } return res; } int main(){ int T;scanf("%d",&T); while (T--){ scanf("%d%d%d",&n,&m,&k); memset(mat,0,sizeof (mat)); int x,y,z; while (m--){ scanf("%d%d",&x,&y); mat[x][y]++; mat[y][x]++; } if (Stoer_Wagner(n)