#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int from;
  int to;
  int next;
} edge[50007 * 2];
int head[10007], tot, n, m, degree[10007];
int ans[50007 * 2], ansi, visit[50007 * 2], flag[50007 * 2];
void addEdge(int u, int v) {
  edge[tot].from = u;
  edge[tot].to = v;
  edge[tot].next = head[u];
  head[u] = tot++;
}
void init() {
  tot = ansi = 0;
  memset(head, -1, sizeof head);
  memset(visit, 0, sizeof visit);
  memset(degree, 0, sizeof degree);
  memset(flag, 0, sizeof flag);
}
void dfs(int now) {
  for (int k = head[now]; k != -1; k = edge[k].next) {
    if (!visit[k]) {
      visit[k] = visit[k ^ 1] = 1;
      dfs(edge[k].to);
      ans[ansi++] = k ^ 1;
    }
  }
}
int cas, u, v;
int main() {
  scanf("%d", &cas);
  while (cas--) {
    scanf("%d%d", &n, &m);
    init();
    for (int i = 0; i < m; i++) {
      scanf("%d%d", &u, &v);
      degree[u]++;
      degree[v]++;
      addEdge(u, v);
      addEdge(v, u);
    }
    int ans1 = 0;
    int js[10007], jsi = 0;
    for (int i = 1; i <= n; i++) {
      if ((degree[i] & 1) == 0) {
        ans1++;
      } else {
        js[jsi++] = i;
      }
    }
    for (int i = 0; i < jsi; i += 2) {
      addEdge(js[i], js[i + 1]);
      addEdge(js[i + 1], js[i]);
    }
    printf("%d\n", ans1);
    for (int i = 1; i <= n; i++) {
      dfs(i);
    }
    for (int i = 0; i < ansi; i++) {
      int d = ans[i];
      if (d < m * 2) printf("%d %d\n", edge[d].from, edge[d].to);
    }
    dfs(1);
  }
  return 0;
}
