#include <bits/stdc++.h>
using namespace std;
const int kMaxn = 200 + 5;
struct Edge {
  int from, to, next;
  bool flag;
} e[kMaxn * kMaxn];
int head[kMaxn], degree[kMaxn];
int top, ed;
vector<int> a;
vector<pair<int, int> > g;
void Init() {
  top = 0;
  memset(head, -1, sizeof(head));
  memset(degree, 0, sizeof(degree));
  g.clear();
  a.clear();
}
void AddEdge(int from, int to) {
  e[top].from = from;
  e[top].to = to;
  e[top].next = head[from];
  e[top].flag = false;
  head[from] = top++;
}
void Dfs(int u) {
  for (int i = head[u]; i != -1; i = e[i].next) {
    if (!e[i].flag) {
      e[i].flag = true;
      e[i ^ 1].flag = true;
      if (i <= ed) g.push_back(make_pair(e[i].from, e[i].to));
      Dfs(e[i].to);
    }
  }
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    Init();
    int n, m;
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= m; i++) {
      int u, v;
      scanf("%d %d", &u, &v);
      AddEdge(u, v);
      AddEdge(v, u);
      degree[u]++;
      degree[v]++;
    }
    ed = top - 1;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      if (degree[i] % 2 == 0)
        ans++;
      else
        a.push_back(i);
    }
    for (int i = 0; i < a.size(); i = i + 2) {
      AddEdge(a[i], a[i + 1]);
      AddEdge(a[i + 1], a[i]);
    }
    for (int i = 0; i < top; i++)
      if (!e[i].flag) Dfs(e[i].from);
    printf("%d\n", ans);
    for (int i = 0; i < g.size(); i++)
      printf("%d %d\n", g[i].first, g[i].second);
  }
  return 0;
}
