#include <bits/stdc++.h>
using namespace std;
const int MAXN = 205;
const int INF = 0x3f3f3f3f;
int N, M;
int head[MAXN];
int tot, ed;
struct Edge {
  int from, to, nex, vis;
} E[MAXN * MAXN];
void add(int a, int b) {
  E[tot] = Edge{a, b, head[a], 0};
  head[a] = tot++;
  E[tot] = Edge{b, a, head[b], 0};
  head[b] = tot++;
}
int du[MAXN];
vector<int> odd;
vector<pair<int, int> > an;
void dfs(int x) {
  for (int i = head[x]; i != -1; i = E[i].nex) {
    if (!E[i].vis) {
      E[i].vis = 1;
      E[i ^ 1].vis = 1;
      dfs(E[i].to);
      if (i < ed) {
        an.push_back({E[i].from, E[i].to});
      }
    }
  }
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    tot = 0;
    odd.clear();
    an.clear();
    memset(du, 0, sizeof(du));
    memset(head, -1, sizeof(head));
    scanf("%d %d", &N, &M);
    for (int i = 1; i <= M; ++i) {
      int a, b;
      scanf("%d %d", &a, &b);
      add(a, b);
      du[a]++;
      du[b]++;
    }
    int ans = 0;
    for (int i = 1; i <= N; ++i) {
      if (du[i] % 2 == 0)
        ans++;
      else
        odd.push_back(i);
    }
    ed = tot;
    for (int i = 0; i + 1 < ((int)(odd).size()); i += 2) {
      add(odd[i], odd[i + 1]);
    }
    for (int i = 0; i < ed; ++i) {
      if (!E[i].vis) dfs(E[i].to);
    }
    printf("%d\n", ans);
    for (int i = 0; i < ((int)(an).size()); ++i) {
      printf("%d %d\n", an[i].first, an[i].second);
    }
  }
  return 0;
}
