#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int N = 205;
int adj[N][N];
int deg[N];
vector<pair<int, int> > ans;
int n, m;
void dfs(int u) {
  for (int i = 1; i <= n; i++) {
    if (adj[u][i] == 1) {
      deg[u]--;
      deg[i]--;
      adj[u][i] = adj[i][u] = 0;
      ans.push_back(make_pair(u, i));
      dfs(i);
      break;
    }
  }
  return;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    memset(adj, 0, sizeof(adj));
    memset(deg, 0, sizeof(deg));
    ans.clear();
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
      int u, v;
      cin >> u >> v;
      adj[u][v] = 1;
      adj[v][u] = 1;
      deg[u]++;
      deg[v]++;
    }
    int fans = 0;
    for (int i = 1; i <= n; i++)
      if (deg[i] % 2 == 0) fans++;
    while (1) {
      int ii = 0;
      for (int i = 1; i <= n; i++) {
        if (deg[i] % 2 == 1) {
          ii = i;
          break;
        }
      }
      if (ii == 0) {
        for (int i = 1; i <= n; i++) {
          if (deg[i] != 0) {
            ii = i;
            break;
          }
        }
      }
      if (ii == 0) break;
      __f("ii", ii);
      dfs(ii);
    }
    cout << fans << "\n";
    for (int i = 0; i < (int)(ans.size()); i++)
      cout << ans[i].first << " " << ans[i].second << "\n";
  }
  return 0;
}
