#include <bits/stdc++.h>
using namespace std;
const int maxn = 205;
int n, m, deg[maxn], vis[maxn][maxn];
vector<int> e[maxn];
void init() {
  memset(vis, 0, sizeof vis);
  memset(deg, 0, sizeof deg);
  for (int i = 0; i < maxn; i++) {
    e[i].clear();
  }
}
void dfs(int u, int p) {
  if (vis[u][p] || vis[p][u]) return;
  vis[p][u] = 1;
  if (p != 0 && u != 0) cout << p << " " << u << "\n";
  for (int i = 0; i < e[u].size(); i++) {
    int v = e[u][i];
    if (vis[u][v] || vis[v][u]) continue;
    dfs(v, u);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    init();
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
      int u, v;
      cin >> u >> v;
      e[u].push_back(v);
      e[v].push_back(u);
      deg[u]++;
      deg[v]++;
    }
    int ans = n;
    for (int i = 1; i <= n; i++)
      if (deg[i] & 1) {
        e[0].push_back(i);
        e[i].push_back(0);
        ans--;
      }
    cout << ans << "\n";
    for (int i = 0; i <= n; i++) {
      for (int j = 0; j < e[i].size(); j++) {
        int v = e[i][j];
        dfs(i, v);
      }
    }
  }
  return 0;
}
