#include <bits/stdc++.h>
using namespace std;
int deg[1000];
int tmp[20000], res[20000], tsz = 0, fsz = 0;
bool vis[20000];
vector<pair<int, int> > g[1000];
int check[205][205];
int p[1000];
int root(int a) { return p[a] == a ? a : (p[a] = root(p[a])); }
void merge(int a, int b) {
  a = root(a), b = root(b);
  if (a != b) p[a] = b;
}
void euler_dfs(int u, int p) {
  tmp[tsz++] = u;
  while (!g[u].empty()) {
    int v = g[u].back().first;
    int j = g[u].back().second;
    g[u].pop_back();
    if (vis[j]) continue;
    vis[j] = 1;
    euler_dfs(v, u);
  }
  res[fsz++] = tmp[--tsz];
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n, m;
    scanf("%d%d", &n, &m);
    tsz = fsz = 0;
    memset(check, 0, sizeof(check));
    memset(vis, 0, sizeof(vis));
    for (int i = 1; i <= n; i++) {
      deg[i] = 0;
      g[i].clear();
      p[i] = i;
    }
    for (int i = 1; i <= m; i++) {
      int a, b;
      scanf("%d%d", &a, &b);
      g[a].push_back(pair<int, int>(b, i));
      g[b].push_back(pair<int, int>(a, i));
      check[a][b]++;
      check[b][a]++;
      deg[a]++;
      deg[b]++;
      merge(a, b);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      if (deg[i] % 2 == 0) ans++;
    }
    int x = 1;
    for (int i = 1; i <= n; i++) {
      if (deg[i] % 2 == 0) continue;
      for (int j = 1; j <= n; j++) {
        if (i == j) continue;
        if (root(i) == root(j) && deg[j] % 2 == 1) {
          g[i].push_back(pair<int, int>(j, m + x));
          g[j].push_back(pair<int, int>(i, m + x));
          x++;
          deg[i]++;
          deg[j]++;
          break;
        }
      }
    }
    printf("%d\n", ans);
    for (int i = 1; i <= n; i++) {
      if (root(i) == i) {
        tsz = fsz = 0;
        euler_dfs(i, 0);
        for (int j = 1; j < fsz; j++) {
          int u = res[j - 1], v = res[j];
          if (check[u][v] == 0) continue;
          printf("%d %d\n", u, v);
          check[u][v]--;
          check[v][u]--;
        }
      }
    }
  }
}
