#include <bits/stdc++.h>
using namespace std;
vector<int> edg[201];
int deg[201];
bool used[201][201];
vector<int> markedEdg[201];
int ptr[201];
int markedEdges;
void markEdge(int u, int v) {
  used[u][v] = used[v][u] = true;
  deg[u]--;
  deg[v]--;
  markedEdges++;
  markedEdg[u].push_back(v);
}
void markEdges(int u) {
  while (ptr[u] < edg[u].size()) {
    int v = edg[u][ptr[u]];
    if (!used[u][v]) {
      markEdge(u, v);
      ptr[u]++;
      markEdges(v);
      break;
    }
    ptr[u]++;
  }
}
void wipe(int n) {
  for (int i = 1; i <= n; i++) {
    ptr[i] = 0;
    edg[i].clear();
    markedEdg[i].clear();
    deg[i] = 0;
    for (int j = 1; j <= n; j++) used[i][j] = false;
  }
  markedEdges = 0;
}
int main() {
  int cases;
  cin >> cases;
  while (cases--) {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
      int u, v;
      cin >> u >> v;
      edg[v].push_back(u);
      edg[u].push_back(v);
      deg[u]++;
      deg[v]++;
    }
    int res = 0;
    for (int i = 1; i <= n; i++) {
      if (deg[i] % 2 == 0) res++;
    }
    for (int i = 1; i <= n; i++) {
      if (deg[i] % 2 == 1) markEdges(i);
    }
    if (markedEdges < m) {
      for (int i = 1; i <= n; i++) {
        if (deg[i] != 0 && deg[i] % 2 == 0) {
          markEdges(i);
        }
      }
    }
    cout << res << endl;
    for (int i = 1; i <= n; i++) {
      for (int j = 0; j < markedEdg[i].size(); j++) {
        cout << i << " " << markedEdg[i][j] << endl;
      }
    }
    wipe(n);
  }
  return 0;
}
