#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200 + 10, MAXE = 200 * 200 + 10;
vector<pair<int, int> > vec[MAXN];
bool mark[MAXE], mark2[MAXN];
pair<int, int> e[MAXE];
void dfs(int v) {
  mark2[v] = true;
  for (int i = 0; i < (int)vec[v].size(); i++) {
    if (!mark[vec[v][i].second]) {
      mark[vec[v][i].second] = true;
      e[vec[v][i].second] = make_pair(v, vec[v][i].first);
      dfs(vec[v][i].first);
    }
  }
}
int main() {
  int o;
  cin >> o;
  for (int _ = 0; _ < o; _++) {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i <= n; i++) {
      vec[i].clear();
      mark2[i] = false;
    }
    for (int i = 0; i <= n + m; i++) mark[i] = false;
    for (int i = 0; i < m; i++) {
      int a, b;
      cin >> a >> b;
      a--, b--;
      vec[a].push_back(make_pair(b, i));
      vec[b].push_back(make_pair(a, i));
    }
    int cnt = m;
    for (int i = 0; i < n; i++)
      if ((int)vec[i].size() % 2 != 0) {
        vec[i].push_back(make_pair(n, cnt));
        vec[n].push_back(make_pair(i, cnt));
        cnt++;
      }
    for (int i = 0; i < n; i++)
      if (!mark2[i]) dfs(i);
    int ans = 0;
    for (int i = 0; i < n; i++) {
      if ((int)vec[i].size() == 0 || vec[i][(int)vec[i].size() - 1].first != n)
        ans++;
    }
    cout << ans << endl;
    for (int i = 0; i < m; i++)
      cout << e[i].first + 1 << " " << e[i].second + 1 << endl;
  }
}
