#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int e[N * 2], nxt[N * 2], now[N], tail = 1, n, m, in[N], out[N], T, vis[N],
                                  oriented[N * 2], ans, cur[N];
void add(int u, int v) {
  e[++tail] = v;
  nxt[tail] = now[u];
  now[u] = tail;
  e[++tail] = u;
  nxt[tail] = now[v];
  now[v] = tail;
}
void init() {
  memset(e, 0, sizeof(e));
  memset(nxt, 0, sizeof(nxt));
  memset(now, 0, sizeof(now));
  memset(in, 0, sizeof(in));
  memset(out, 0, sizeof(out));
  memset(vis, 0, sizeof(vis));
  memset(oriented, 0, sizeof(oriented));
  tail = 1;
  n = m = ans = 0;
}
void dfs(int x) {
  vis[x] = 1;
  for (int &i = cur[x]; i; i = nxt[i])
    if (!oriented[i] && !oriented[i ^ 1]) {
      oriented[i] = 1;
      printf("%d %d\n", x, e[i]);
      dfs(e[i]);
      break;
    }
}
int main() {
  scanf("%d", &T);
  while (T--) {
    init();
    scanf("%d%d", &n, &m);
    for (int i = 1, x, y; i <= m; i++) {
      scanf("%d%d", &x, &y);
      add(x, y);
      in[x]++, in[y]++;
    }
    for (int i = 1; i <= n; i++)
      if ((in[i] & 1) == 0) ans++;
    printf("%d\n", ans);
    for (int i = 1; i <= n; i++) cur[i] = now[i];
    for (int i = 1; i <= n; i++)
      if ((in[i] & 1) == 1) dfs(i);
    for (int i = 1; i <= n; i++)
      if (cur[i]) dfs(i);
  }
  return 0;
}
