#include <bits/stdc++.h>
using namespace std;
long long n, m, x, y, k, T, p[300], a[300][300];
void dfs(int i) {
  for (int j = 0; j <= n; j++)
    if (a[i][j]) {
      a[i][j] = a[j][i] = 0;
      p[i]--;
      p[j]--;
      if (j && i) cout << j << " " << i << endl;
      dfs(j);
    }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> T;
  for (int t = 0; t < T; t++) {
    cin >> n >> m;
    for (int i = 0; i <= n; i++)
      for (int j = 0; j <= n; j++) a[i][j] = 0, p[i] = 0;
    for (int i = 0; i < m; i++)
      cin >> x >> y, a[x][y]++, a[y][x]++, p[x]++, p[y]++;
    k = 0;
    for (int i = 1; i <= n; i++)
      if (p[i] & 1)
        a[0][i] = a[i][0] = 1;
      else
        k++;
    cout << k << endl;
    for (int i = 1; i <= n; i++)
      if (p[i]) dfs(i);
  }
  return 0;
}
