#include <bits/stdc++.h>
using namespace std;
class Solution {
 public:
  FILE *in;
  FILE *out;
  struct Edge {
    int next;
    int node1, node2;
    int fictive, dir;
  };
  int n, m;
  int start[208];
  Edge edges[20008 << 1];
  int numEdges;
  int degrees[208];
  int ans_cnt;
  vector<pair<int, int> > ans;
  int degree[208];
  void addEdge(int node1, int node2, int fictive) {
    for (int i = 0; i < 2; i++) {
      edges[numEdges].node1 = node1;
      edges[numEdges].node2 = node2;
      edges[numEdges].fictive = fictive;
      edges[numEdges].dir = -1;
      edges[numEdges].next = start[node1];
      start[node1] = numEdges++;
      node1 ^= node2 ^= node1 ^= node2;
    }
  }
  void euler(int node) {
    for (int idx = start[node]; idx != -1; idx = edges[idx].next) {
      if (edges[idx].dir == -1) {
        edges[idx ^ 0].dir = 0;
        edges[idx ^ 1].dir = 1;
        euler(edges[idx].node2);
      }
    }
  }
  int main(void) {
    in = stdin;
    out = stdout;
    numEdges = 0;
    memset(start, -1, sizeof(start));
    memset(degrees, 0, sizeof(degrees));
    numEdges = 0;
    memset(degree, 0, sizeof(degree));
    ans_cnt = 0;
    ans.clear();
    fscanf(in, "%d %d", &n, &m);
    for (int i = 0; i < m; i++) {
      int n1, n2;
      fscanf(in, "%d %d", &n1, &n2);
      addEdge(n1 - 1, n2 - 1, 0);
    }
    int last = -1;
    for (int i = 0; i < n; i++) {
      int parity = 0;
      for (int idx = start[i]; idx != -1; idx = edges[idx].next) parity ^= 1;
      if (parity == 1) {
        if (last == -1)
          last = i;
        else {
          addEdge(last, i, 1);
          last = -1;
        }
      }
    }
    for (int i = 0; i < numEdges; i++)
      if (edges[i].dir == -1) euler(edges[i].node1);
    for (int i = 0; i < numEdges; i++)
      if (!edges[i].fictive && edges[i].dir == 0)
        ans.push_back(make_pair(edges[i].node1 + 1, edges[i].node2 + 1));
    for (int i = 0; i < (int)(ans.size()); i++)
      ++degree[ans[i].first], --degree[ans[i].second];
    for (int i = 1; i <= n; i++)
      if (degree[i] == 0) ++ans_cnt;
    printf("%d\n", ans_cnt);
    for (int i = 0; i < (int)(ans.size()); i++)
      printf("%d %d\n", (int)(ans[i].first), (int)(ans[i].second));
    return 0;
  }
} sol;
int main() {
  int tests;
  scanf("%d", &tests);
  while (tests--) {
    sol.main();
  }
}
