#include <bits/stdc++.h>
using namespace std;
const int N = 205;
int d[N], head[N], tot;
int to[N * N], nex[N * N], vis[N * N];
vector<pair<int, int> > ans;
void init() {
  tot = 0;
  memset(d, 0, sizeof(d));
  memset(head, -1, sizeof(head));
  ans.clear();
}
void add(int u, int v, int w) {
  d[v]++;
  to[tot] = v;
  nex[tot] = head[u];
  vis[tot] = w;
  head[u] = tot++;
}
void dfs(int x) {
  for (int& i = head[x]; ~i;) {
    if (vis[i] == 1) {
      i = nex[i];
      continue;
    }
    if (vis[i] == 0) ans.push_back(make_pair(x, to[i]));
    vis[i] = vis[i ^ 1] = 1;
    dfs(to[i]);
  }
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    init();
    int n, m, u, v;
    scanf("%d%d", &n, &m);
    for (int i = 0; i < m; i++) {
      scanf("%d%d", &u, &v);
      add(u, v, 0);
      add(v, u, 0);
    }
    vector<int> tmp;
    int ret = n;
    for (int i = 1; i <= n; i++)
      if (d[i] & 1) tmp.push_back(i), ret--;
    for (int i = 0; i < tmp.size(); i += 2) {
      add(tmp[i], tmp[i + 1], -1);
      add(tmp[i + 1], tmp[i], -1);
    }
    for (int i = 1; i <= n; i++) dfs(i);
    printf("%d\n", ret);
    for (int i = 0; i < ans.size(); i++)
      printf("%d %d\n", ans[i].first, ans[i].second);
  }
  return 0;
}
