#include <bits/stdc++.h>
using namespace std;
const int N = 405;
int n, m, h[N], num = 1, ans, d[N], vis[2 * N * N];
struct Edge {
  int x, t;
} e[N * N];
vector<int> G;
inline int read() {
  int f = 1, x = 0;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return f * x;
}
inline void add(int s, int t) { e[++num].x = h[s], e[num].t = t, h[s] = num; }
inline void dfs(int u) {
  for (int& i = h[u]; i; i = e[i].x)
    if (!vis[i >> 1]) {
      vis[i >> 1] = 1;
      if ((i >> 1) <= m) printf("%d %d\n", u, e[i].t);
      dfs(e[i].t);
    }
}
inline void solve() {
  memset(h, 0, sizeof(h)), memset(d, 0, sizeof(d)), memset(vis, 0, sizeof(vis)),
      num = 1, ans = 0, G.clear();
  n = read(), m = read();
  for (int i = (1), iend = (m); i <= iend; i++) {
    int x = read(), y = read();
    add(x, y), add(y, x);
    d[x]++, d[y]++;
  }
  for (int i = (1), iend = (n); i <= iend; i++)
    if (d[i] & 1)
      G.push_back(i);
    else
      ans++;
  printf("%d\n", ans);
  for (int i = (0), iend = (G.size() - 1); i <= iend; i++)
    if (i & 1) add(G[i], G[i - 1]), add(G[i - 1], G[i]);
  for (int i = (1), iend = (n); i <= iend; i++) dfs(i);
}
int main() {
  int T = read();
  while (T--) solve();
  return 0;
}
