#include <bits/stdc++.h>
using namespace std;
template <class T1>
T1 GCD(T1 A, T1 B) {
  if (B == 0)
    return A;
  else
    return GCD(B, A % B);
}
template <class T2>
T2 mulmod(T2 a, T2 b) {
  T2 x = 0, y = a % 1000000007;
  while (b) {
    if (b % 2 == 1) {
      x = (x + y) % 1000000007;
    }
    y = (2 * y) % 1000000007;
    b = b / 2;
  }
  return x % 1000000007;
}
template <class T3>
T3 power(T3 a, T3 b) {
  T3 x = 1, y = a % 1000000007;
  while (b) {
    if (b % 2 == 1) {
      x = mulmod(x, y) % 1000000007;
    }
    y = mulmod(y, y) % 1000000007;
    b = b / 2;
  }
  return x % 1000000007;
}
template <class T4>
bool cmp(T4 x, T4 y) {
  return x > y ? 1 : 0;
}
int n, m;
set<int> ans[206];
void dfs(int u) {
  while (ans[u].size()) {
    int v = *ans[u].begin();
    ans[u].erase(v);
    ans[v].erase(ans[v].find(u));
    if (v != n + 1 && u != n + 1) cout << u << " " << v << endl;
    dfs(v);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    int x, y;
    cin >> n >> m;
    for (int i = 1; i <= 204; i++) ans[i].clear();
    for (int i = 0; i < m; i++) {
      cin >> x >> y;
      ans[y].insert(x);
      ans[x].insert(y);
    }
    int ns = 0;
    for (int i = 1; i <= n; i++) {
      ns += ans[i].size() & 1 ^ 1;
    }
    cout << ns << endl;
    for (int i = 1; i <= n; i++)
      if (ans[i].size() & 1) {
        ans[n + 1].insert(i);
        ans[i].insert(n + 1);
      }
    for (int i = 1; i <= n; i++) dfs(i);
  }
  return 0;
}
