#include <bits/stdc++.h>
using namespace std;
unordered_set<int> G[210];
void dfs(int u) {
  while (!G[u].empty()) {
    int v = (*G[u].begin());
    G[u].erase(v);
    G[v].erase(u);
    dfs(v);
    if (u && v) cout << u << ' ' << v << endl;
  }
}
int main(void) {
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t-- > 0) {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i <= n; ++i) G[i].clear();
    for (int i = 0; i < m; ++i) {
      int u, v;
      cin >> u >> v;
      G[u].insert(v);
      G[v].insert(u);
    }
    for (int i = 1; i <= n; ++i)
      if (G[i].size() % 2 == 1) {
        G[0].insert(i);
        G[i].insert(0);
      }
    cout << n - G[0].size() << endl;
    for (int i = 0; i <= n; ++i)
      if (G[i].size()) {
        dfs(i);
      }
  }
  return 0;
}
