#include <bits/stdc++.h>
using namespace std;
int read() {
  register int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = 10 * x + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int Size = 205;
const int INF = 0x3f3f3f3f;
int n, m, S, cnt, indegree[Size];
int to[Size][Size];
int pos, ans1[Size * Size], ans2[Size * Size];
void dfs(int x) {
  for (int i = 1; i <= S; i++) {
    if (to[x][i]) {
      to[x][i] = to[i][x] = 0;
      if (x != S && i != S) {
        printf("%d %d\n", x, i);
      }
      dfs(i);
    }
  }
}
int main() {
  int T = read();
  while (T--) {
    memset(to, 0, sizeof(to));
    memset(indegree, 0, sizeof(indegree));
    n = read();
    m = read();
    for (register int i = 1; i <= m; i++) {
      int u = read();
      int v = read();
      to[u][v] = to[v][u] = 1;
      indegree[u]++;
      indegree[v]++;
    }
    pos = 0;
    S = n + 1;
    int ans = 0;
    for (register int i = 1; i <= n; i++) {
      if (indegree[i] & 1) {
        to[i][S] = to[S][i] = 1;
        indegree[S]++;
        indegree[i]++;
      } else {
        ans++;
      }
    }
    printf("%d\n", ans);
    for (register int i = 1; i <= n; i++) {
      dfs(i);
    }
  }
  return 0;
}
