#include <bits/stdc++.h>
using namespace std;
struct Graph {
  long long n, m;
  set<long long> nei[405];
  stack<long long> euler;
  set<long long> eulerNei[405];
  void getEulerUtil(long long v) {
    while (!eulerNei[v].empty()) {
      set<long long>::iterator it = eulerNei[v].begin();
      long long u = *it;
      eulerNei[u].erase(v);
      eulerNei[v].erase(u);
      getEulerUtil(u);
    }
    euler.push(v);
  }
  vector<long long> getEuler(long long src) {
    while (!euler.empty()) {
      euler.pop();
    }
    for (long long i = 1; i <= n; ++i) {
      for (set<long long>::iterator it = nei[i].begin(); it != nei[i].end();
           ++it) {
        eulerNei[i].insert(*it);
      }
    }
    getEulerUtil(src);
    vector<long long> ret;
    while (!euler.empty()) {
      ret.push_back(euler.top());
      euler.pop();
    }
    return ret;
  }
};
long long vis[405];
int main() {
  ios::sync_with_stdio(false);
  long long t;
  cin >> t;
  while (t--) {
    Graph g;
    cin >> g.n >> g.m;
    long long N = g.n;
    for (long long i = 0; i < g.m; ++i) {
      long long u, v;
      cin >> u >> v;
      g.nei[u].insert(v);
      g.nei[v].insert(u);
    }
    vector<long long> oddDegVertices;
    for (long long i = 1; i <= g.n; ++i) {
      if (g.nei[i].size() % 2 == 1) {
        oddDegVertices.push_back(i);
      }
    }
    for (long long i = 0; i < oddDegVertices.size(); i += 2) {
      g.nei[oddDegVertices[i]].insert(g.n + 1);
      g.nei[g.n + 1].insert(oddDegVertices[i]);
      g.nei[oddDegVertices[i + 1]].insert(g.n + 1);
      g.nei[g.n + 1].insert(oddDegVertices[i + 1]);
      g.n++;
    }
    long long chkn = N;
    long long chkm = g.m;
    for (long long i = 1; i <= g.n; ++i) {
      vis[i] = false;
    }
    vector<vector<long long> > cycles;
    for (long long i = 1; i <= g.n; ++i) {
      if (!vis[i]) {
        vector<long long> eulerCycle = g.getEuler(i);
        cycles.push_back(eulerCycle);
        for (long long j = 0; j < eulerCycle.size(); ++j) {
          vis[eulerCycle[j]] = true;
        }
      }
    }
    cout << N - oddDegVertices.size() << endl;
    for (long long j = 0; j < cycles.size(); ++j) {
      vector<long long> eulerCycle = cycles[j];
      for (long long i = 0; i < eulerCycle.size() - 1; ++i) {
        if (eulerCycle[i] <= N && eulerCycle[i + 1] <= N) {
          cout << eulerCycle[i] << " " << eulerCycle[i + 1] << endl;
        }
      }
    }
  }
}
