#include <bits/stdc++.h>
using namespace std;
const int MAXC = 202;
const int MAXP = 200;
int t, n, m;
int t_i;
int e[MAXC][MAXC];
vector<vector<int> > adj;
vector<pair<int, int> > path[MAXP];
int degs[MAXP];
void EulerP(int v) {
  for (int w : adj[v]) {
    if (e[v][w]) {
      if (e[v][w] == 1) path[t_i].push_back(pair<int, int>(v, w));
      e[w][v] = e[v][w] = 0;
      EulerP(w);
    }
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> t;
  int v1, v2;
  for (t_i = 0; t_i < t; t_i++) {
    cin >> n >> m;
    memset(e, MAXC * MAXC, sizeof(e[0][0]));
    adj = vector<vector<int> >(n + 2, vector<int>());
    for (int j = 0; j < m; ++j) {
      cin >> v1 >> v2;
      e[v1][v2] = 1;
      e[v2][v1] = 1;
      adj[v1].push_back(v2);
      adj[v2].push_back(v1);
    }
    int n_even = 0;
    vector<int> odd;
    for (int v = 1; v <= n; ++v) {
      if (!(adj[v].size() % 2))
        n_even++;
      else {
        odd.push_back(v);
      }
    }
    for (int i = 0; i < odd.size(); ++i) {
      e[odd[i]][n + 1] = e[n + 1][odd[i]] = 2;
      adj[n + 1].push_back(odd[i]);
      adj[odd[i]].push_back(n + 1);
    }
    degs[t_i] = n_even;
    for (int v = 1; v <= n; ++v) EulerP(v);
  }
  for (t_i = 0; t_i < t; t_i++) {
    cout << degs[t_i] << endl;
    for (int j = 0; j < path[t_i].size(); ++j) {
      cout << path[t_i][j].first << " " << path[t_i][j].second << endl;
    }
  }
  return 0;
}
