#include <bits/stdc++.h>
using namespace std;
int n, m, cnt = 1;
int head[205], vet[50005], Next[50005], cost[50005], in[205], vis[50005],
    mark[205];
void add(int x, int y, int w) {
  cnt++;
  Next[cnt] = head[x];
  head[x] = cnt;
  vet[cnt] = y;
  cost[cnt] = w;
}
void euler(int x) {
  mark[x] = 1;
  for (int i = head[x]; i; i = Next[i]) {
    int v = vet[i];
    if (vis[i]) continue;
    vis[i] = vis[i ^ 1] = 1;
    if (cost[i]) printf("%d %d\n", v, x);
    euler(v);
  }
}
void solve() {
  memset(head, 0, sizeof(head));
  memset(vis, 0, sizeof(vis));
  memset(in, 0, sizeof(in));
  memset(mark, 0, sizeof(mark));
  cin >> n >> m;
  int x, y;
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &x, &y);
    add(x, y, 1);
    add(y, x, 1);
    in[x]++, in[y]++;
  }
  int t = n + 1, cnt = 0;
  for (int i = 1; i <= n; ++i) {
    if (in[i] & 1) {
      cnt++;
      add(t, i, 0);
      add(i, t, 0);
    }
  }
  cout << n - cnt << endl;
  for (int i = 1; i <= t; ++i) {
    if (!mark[i]) euler(i);
  }
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}
