#include <bits/stdc++.h>
using namespace std;
const int N = 205;
int T, n, m, in[N], mat[N][N];
void dfs(int u) {
  for (int i = 1; i <= n + 1; i++) {
    if (mat[u][i]) {
      mat[u][i] = mat[i][u] = 0;
      if (u != n + 1 && i != n + 1) printf("%d %d\n", u, i);
      dfs(i);
    }
  }
}
int main() {
  scanf("%d", &T);
  while (T--) {
    memset(mat, 0, sizeof(mat));
    memset(in, 0, sizeof(in));
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= m; i++) {
      int u, v;
      scanf("%d%d", &u, &v);
      mat[u][v] = mat[v][u] = 1;
      in[u]++, in[v]++;
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      if (in[i] % 2 == 1) {
        mat[i][n + 1] = mat[n + 1][i] = 1;
        in[n + 1]++, in[i]++;
      } else
        ans++;
    }
    printf("%d\n", ans);
    for (int i = 1; i <= n; i++) dfs(i);
  }
  return 0;
}
