#include <bits/stdc++.h>
using namespace std;
const int MAXN = 210;
int N, M;
bool vis[MAXN];
multiset<int> adj[MAXN];
multiset<pair<int, int> > ans;
void dfs(int x) {
  vis[x] = true;
  while (!adj[x].empty()) {
    auto it = adj[x].begin();
    int t = *it;
    adj[x].erase(it);
    adj[t].erase(adj[t].find(x));
    ans.insert(pair<int, int>(x, t));
    dfs(t);
  }
}
void go() {
  memset(vis, 0, sizeof(vis));
  scanf("%d %d", &N, &M);
  for (int i = 1; i <= N; i++) {
    adj[i].clear();
  }
  ans.clear();
  for (int i = 1; i <= M; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    adj[x].insert(y);
    adj[y].insert(x);
  }
  vector<int> odds;
  for (int i = 1; i <= N; i++) {
    if (adj[i].size() & 1) {
      odds.push_back(i);
    }
  }
  for (int i = 0; i < odds.size(); i += 2) {
    adj[odds[i]].insert(odds[i + 1]);
    adj[odds[i + 1]].insert(odds[i]);
  }
  for (int i = 1; i <= N; i++) {
    if (!vis[i]) {
      dfs(i);
    }
  }
  for (int i = 0; i < odds.size(); i += 2) {
    auto it = ans.find(pair<int, int>(odds[i], odds[i + 1]));
    if (it == ans.end()) {
      it = ans.find(pair<int, int>(odds[i + 1], odds[i]));
    }
    ans.erase(it);
  }
  printf("%lu\n", N - odds.size());
  for (pair<int, int> p : ans) {
    printf("%d %d\n", p.first, p.second);
  }
}
int main() {
  int nt;
  for (scanf("%d", &nt); nt--; go())
    ;
}
