#include <bits/stdc++.h>
const int maxn = 205;
const int maxm = (maxn * maxn) >> 1;
bool vis[maxm << 1];
bool visn[maxn];
int d[maxn];
int n, m;
int first[maxn];
struct EDGE {
  int from, to;
  bool vis;
} edge[maxm];
struct Edge {
  int to, nxt;
  int num;
} e[(maxm << 1) + maxn];
int nowm;
inline void addedge(int f, int t, int ti) {
  d[f]++;
  d[t]++;
  e[++nowm].nxt = first[f];
  e[nowm].to = t;
  e[nowm].num = ti;
  first[f] = nowm;
  e[++nowm].nxt = first[t];
  e[nowm].to = f;
  first[t] = nowm;
  e[nowm].num = ti;
}
inline void init() {
  memset(visn, 0, sizeof(visn));
  memset(vis, 0, sizeof(vis));
  memset(d, 0, sizeof(d));
  memset(edge, 0, sizeof(edge));
  memset(e, 0, sizeof(e));
  memset(first, 0, sizeof(first));
  nowm = 0;
}
inline void dfs(int now) {
  visn[now] = true;
  for (int i = first[now]; i; i = e[i].nxt) {
    int u = e[i].to;
    if (!vis[e[i].num]) {
      vis[e[i].num] = true;
      dfs(u);
      if (now != n + 1 && u != n + 1) printf("%d %d\n", u, now);
    }
  }
}
inline void solve() {
  scanf("%d%d", &n, &m);
  init();
  for (int i = 1, f, t; i <= m; ++i) {
    scanf("%d%d", &f, &t);
    addedge(f, t, i);
  }
  int ans = 0;
  for (int i = 1, tmp = m; i <= n; ++i) {
    if (d[i] & 1)
      addedge(n + 1, i, ++tmp);
    else
      ans++;
  }
  printf("%d\n", ans);
  for (int i = 1; i <= n; ++i)
    if (!visn[i]) dfs(i);
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) solve();
  return 0;
}
