#include <bits/stdc++.h>
const int Maxn = 222;
int T, n, m, d[Maxn];
bool g[Maxn][Maxn];
int getint() {
  int c = getchar(), ret = 0;
  while (c < '0' || c > '9') {
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    ret = ret * 10 + (c ^ 48);
    c = getchar();
  }
  return ret;
}
void dfs(int v) {
  for (int i = 1; i <= n + 1; ++i) {
    if (g[v][i]) {
      g[v][i] = g[i][v] = false;
      dfs(i);
      if (v != n + 1 && i != n + 1) {
        printf("%d %d\n", v, i);
      }
    }
  }
}
int main() {
  T = getint();
  while (T--) {
    n = getint();
    m = getint();
    memset(d, 0, sizeof(d));
    memset(g, false, sizeof(g));
    while (m--) {
      int v1 = getint(), v2 = getint();
      g[v1][v2] = g[v2][v1] = true;
      ++d[v1];
      ++d[v2];
    }
    int sum = 0;
    for (int i = 1; i <= n; ++i) {
      if (d[i] & 1) {
        g[i][n + 1] = g[n + 1][i] = true;
        ++sum;
      }
    }
    printf("%d\n", n - sum);
    for (int i = 1; i <= n; ++i) {
      dfs(i);
    }
  }
  return 0;
}
