#include <bits/stdc++.h>
using namespace std;
const int maxn = 50005;
const int mod = 1e9 + 7;
long long qpow(long long a, long long b) {
  long long res = 1;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
struct graph {
  int head[maxn], nxt[maxn << 1], to[maxn << 1], w[maxn << 1], sz;
  void init() { memset(head, -1, sizeof(head)); }
  graph() { init(); }
  void push(int a, int b, int c = 0) {
    nxt[sz] = head[a], to[sz] = b, w[sz] = c, head[a] = sz++;
  }
  int& operator[](const int a) { return to[a]; }
} g;
int use;
int deg[205];
bool vis[205];
int stk[maxn], top;
bool edge[maxn];
void dfs(int now) {
  vis[now] = 1;
  for (int& i = g.head[now]; ~i; i = g.nxt[i]) {
    if (edge[i]) continue;
    edge[i] = edge[i ^ 1] = 1;
    dfs(g[i]);
  }
  stk[++top] = now;
}
bool can[201][201];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n, m;
    top = 0;
    memset(edge, 0, sizeof(edge));
    memset(vis, 0, sizeof(vis));
    memset(deg, 0, sizeof(deg));
    memset(can, 0, sizeof(can));
    g.sz = 0;
    g.init();
    scanf("%d%d", &n, &m);
    int ans = 0;
    for (int i = 1, a, b; i <= m; ++i) {
      scanf("%d%d", &a, &b);
      g.push(a, b), g.push(b, a);
      can[a][b] = can[b][a] = 1;
      deg[a]++, deg[b]++;
    }
    vector<int> odd;
    for (int i = 1; i <= n; ++i) {
      if (deg[i] & 1)
        odd.push_back(i);
      else
        ans++;
    }
    use = g.sz;
    for (int i = 0; i < odd.size(); i += 2) {
      g.push(odd[i], odd[i + 1]);
      g.push(odd[i + 1], odd[i]);
    }
    printf("%d\n", ans);
    for (int i = 1; i <= n; ++i) {
      if (!vis[i]) {
        top = 0;
        dfs(i);
        for (int i = top; i >= 2; --i) {
          if (can[stk[i]][stk[i - 1]]) {
            printf("%d %d\n", stk[i], stk[i - 1]);
            can[stk[i]][stk[i - 1]] = can[stk[i - 1]][stk[i]] = 0;
          }
        }
      }
    }
  }
  return 0;
}
