#include <bits/stdc++.h>
using namespace std;
int ed[1010][1010], in[1010], ans, n, m;
void dfs(int p) {
  for (int i = 1; i <= n + 1; i++)
    if (ed[p][i]) {
      ed[p][i] = ed[i][p] = false;
      if (p != n + 1 && i != n + 1) printf("%d %d\n", p, i);
      dfs(i);
    }
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d", &n, &m), ans = 0;
    for (int i = 1; i <= n; i++) in[i] = 0;
    for (int i = 1; i <= n + 1; i++)
      for (int j = 1; j <= n + 1; j++) ed[i][j] = false;
    for (int i = 1, x, y; i <= m; i++)
      scanf("%d%d", &x, &y), ed[x][y] = ed[y][x] = true, in[x]++, in[y]++;
    for (int i = 1; i <= n; i++) ans += (in[i] + 1) % 2;
    for (int i = 1; i <= n; i++)
      if (in[i] % 2) ed[n + 1][i] = ed[i][n + 1] = true, in[n + 1]++, in[i]++;
    printf("%d\n", ans);
    for (int i = 1; i <= n; i++) dfs(i);
  }
}
