#include <bits/stdc++.h>
using namespace std;
int T, n, m, sa[40010], sb[40010], ls, du[201], ans;
bool g[201][201];
int getint() {
  int w = 0;
  bool q = 0;
  char c = getchar();
  while ((c > '9' || c < '0') && c != '-') c = getchar();
  if (c == '-') c = getchar(), q = 1;
  while (c >= '0' && c <= '9') w = w * 10 + c - '0', c = getchar();
  return q ? -w : w;
}
void dfs(int u) {
  while (du[u]) {
    for (int i = 1; i <= n; i++)
      if (g[u][i]) {
        ls++;
        sa[ls] = u;
        sb[ls] = i;
        du[u]--, du[i]--;
        g[u][i] = g[i][u] = 0;
        u = i;
        break;
      }
  }
}
int main() {
  T = getint();
  while (T--) {
    ans = n = getint();
    m = getint();
    for (int i = 1, x, y; i <= m; i++) {
      x = getint();
      y = getint();
      g[x][y] = g[y][x] = 1;
      du[x]++;
      du[y]++;
    }
    for (int i = 1; i <= n; i++) ans -= du[i] & 1;
    printf("%d\n", ans);
    for (int i = 1; i <= n; i++)
      if (du[i] & 1)
        while (du[i]) dfs(i);
    for (int i = 1; i <= n; i++)
      while (du[i]) dfs(i);
    for (int i = 1; i <= ls; i++) printf("%d %d\n", sa[i], sb[i]);
    ls = 0;
  }
}
