#include <bits/stdc++.h>
using namespace std;
const int maxed = 200 + 10;
struct E {
  int v, bef, wa;
} e[maxed * maxed];
struct Node {
  int u, v;
} node[maxed * maxed];
int n, m, ans, cnt, head[maxed], d[maxed];
bool vis[maxed][maxed];
int main() {
  void add_(int, int, int);
  void slove(int);
  int N;
  scanf("%d", &N);
  while (N--) {
    ans = 1;
    memset(head, -1, sizeof(head));
    scanf("%d%d", &n, &m);
    int a, b;
    while (m--) {
      scanf("%d%d", &a, &b);
      add_(a, b, -1);
      add_(b, a, -1);
      d[a]++;
      d[b]++;
    }
    int answer = n;
    for (int i = 1; i <= n; i++)
      if (d[i] & 1) {
        answer--;
        d[i]++;
        d[n + 1]++;
        add_(i, n + 1, 1);
        add_(n + 1, i, 1);
      }
    cnt = 0;
    memset(vis, false, sizeof(vis));
    for (int i = 1; i <= n; i++) slove(i);
    printf("%d\n", answer);
    for (int i = 0; i < cnt; i++) printf("%d %d\n", node[i].u, node[i].v);
  }
  return 0;
}
void add_(int x, int y, int cur) {
  e[ans].v = y;
  e[ans].wa = cur;
  e[ans].bef = head[x];
  head[x] = ans++;
}
void slove(int x) {
  for (int i = head[x]; i != -1; i = e[i].bef)
    if (!vis[x][e[i].v]) {
      vis[x][e[i].v] = vis[e[i].v][x] = true;
      if (e[i].wa == -1) {
        node[cnt].u = x;
        node[cnt].v = e[i].v;
        cnt++;
      }
      slove(e[i].v);
    }
}
