#include <bits/stdc++.h>
int n, m, cnt, even_point;
int lst[(210)], nxt[(50010)], to[(50010)];
int deg[(210)], vis[(50010) >> 1];
std::queue<std::pair<int, int> > ans;
void addedge(int u, int v) {
  to[++cnt] = v;
  nxt[cnt] = lst[u];
  lst[u] = cnt;
  to[++cnt] = u;
  nxt[cnt] = lst[v];
  lst[v] = cnt;
}
void dfs(int u) {
  for (int i = lst[u]; i; i = nxt[i]) {
    int v = to[i];
    if (!vis[i >> 1]) {
      vis[i >> 1] = true;
      if ((i >> 1) <= m) ans.push(std::make_pair(u, v));
      dfs(v);
    }
  }
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    cnt = 1;
    even_point = 0;
    memset(lst, 0, sizeof(lst));
    memset(deg, 0, sizeof(deg));
    memset(vis, 0, sizeof(vis));
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= m; ++i) {
      int u, v;
      scanf("%d%d", &u, &v);
      addedge(u, v);
      ++deg[u];
      ++deg[v];
    }
    for (int i = 1; i <= n; ++i) {
      if (deg[i] & 1)
        addedge(i, n + 1);
      else
        ++even_point;
    }
    for (int i = 1; i <= n; ++i) dfs(i);
    printf("%d\n", even_point);
    while (!ans.empty()) {
      auto u = ans.front();
      ans.pop();
      printf("%d %d\n", u.first, u.second);
    }
  }
  return 0;
}
