#include <bits/stdc++.h>
using namespace std;
vector<int> g[2000];
void DFS(int v, int n) {
  while (g[v].size() != 0) {
    int x = g[v].back();
    g[v].pop_back();
    for (int k = 0; k < g[x].size(); k++)
      if (g[x][k] == v) {
        g[x].erase(g[x].begin() + k);
        break;
      }
    DFS(x, n);
    if (v != n + 1 && x != n + 1) cout << v << " " << x << endl;
  }
}
int main() {
  int t, n, m;
  cin >> t;
  for (int k = 0; k < t; k++) {
    cin >> n >> m;
    int odd[n];
    memset(odd, 0, sizeof(odd));
    int r = 0;
    for (int x, y, i = 1; i <= m; i++) {
      cin >> x >> y;
      g[x].push_back(y);
      g[y].push_back(x);
    }
    for (int l = 1; l <= n; l++)
      if (g[l].size() % 2 == 1) {
        odd[r] = l;
        r++;
      }
    for (int o = 0; o < r; o++) {
      g[odd[o]].push_back(n + 1);
      g[n + 1].push_back(odd[o]);
    }
    cout << n - r << endl;
    for (int q = 1; q <= n; q++) DFS(q, n);
  }
  return 0;
}
