#include <bits/stdc++.h>
using namespace std;
int hmt() {
  int x = 0;
  int c = getchar(), n = 0;
  for (; !isdigit(c); c = getchar()) n = (c == '-');
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  if (n) x = -x;
  return x;
}
const int N = 210;
int G[N][N], n, m, dd[N][N], d[N];
void DFS(int u) {
  for (int v = 0, _b = n; v <= _b; ++v)
    if (G[u][v] && !dd[u][v]) {
      dd[u][v] = dd[v][u] = 1;
      DFS(v);
      if (u && v) cout << u << " " << v << endl;
    }
}
int main() {
  for (int cs = 1, _b = hmt(); cs <= _b; ++cs) {
    n = hmt(), m = hmt();
    memset(dd, 0, sizeof(dd));
    memset(G, 0, sizeof(G));
    memset(d, 0, sizeof(d));
    while (m--) {
      int u = hmt(), v = hmt();
      d[u]++;
      d[v]++;
      G[u][v] = 1;
      G[v][u] = 1;
    }
    int ans = 0;
    for (int i = 1, _b = n; i <= _b; ++i) {
      if (d[i] % 2 == 0)
        ++ans;
      else
        G[i][0] = G[0][i] = 1;
    }
    cout << ans << endl;
    for (int i = 0, _b = n; i <= _b; ++i) DFS(i);
  }
}
