#include <bits/stdc++.h>
using namespace std;
const int maxN = 202;
int n, m;
int a[maxN][maxN];
int adj[maxN], deg[maxN];
bool marked[maxN];
vector<int> odd, EC;
stack<int> S;
void DFS(int u) {
  marked[u] = true;
  if (deg[u] & 1) odd.push_back(u);
  for (int v = 1; v <= n; ++v)
    if (a[u][v] == 1 && !marked[v]) DFS(v);
}
int hasPath(int u) {
  for (int v = 1; v <= n; ++v)
    if (a[u][v] == 1) {
      a[u][v] = 2;
      a[v][u] = 3;
      return v;
    }
  if (adj[u] > 0) {
    int v = adj[u];
    adj[u] = 0;
    return v;
  }
  return 0;
}
int main() {
  int nTests;
  scanf("%d", &nTests);
  while (nTests--) {
    scanf("%d %d", &n, &m);
    memset(a, 0, sizeof(a));
    memset(deg, 0, sizeof(deg));
    for (int i = 0; i < m; ++i) {
      int u, v;
      scanf("%d %d", &u, &v);
      a[u][v] = a[v][u] = 1;
      ++deg[u];
      ++deg[v];
    }
    int res = 0;
    for (int u = 1; u <= n; ++u)
      if (!(deg[u] & 1)) ++res;
    printf("%d\n", res);
    memset(marked, false, sizeof(marked));
    for (int u = 1; u <= n; ++u)
      if (!marked[u]) {
        odd.clear();
        DFS(u);
        for (int i = 0, sz = odd.size(); i < sz; i += 2) {
          adj[odd[i]] = odd[i + 1];
          adj[odd[i + 1]] = odd[i];
        }
        while (!S.empty()) S.pop();
        EC.clear();
        S.push(u);
        while (!S.empty()) {
          int u = S.top();
          int v = hasPath(u);
          if (v > 0)
            S.push(v);
          else {
            S.pop();
            EC.push_back(u);
          }
        }
      }
    for (int u = 1; u <= n; ++u)
      for (int v = 1; v <= n; ++v)
        if (a[u][v] == 2) printf("%d %d\n", u, v);
  }
  return 0;
}
