#include <bits/stdc++.h>
using namespace std;
int n, m;
struct Data {
  int tov, next;
  int flag;
  int flag1;
} data[205 * 205 * 2];
int head[205];
int tot;
void insert(int a, int b, int f) {
  data[tot].tov = b;
  data[tot].flag = f;
  data[tot].next = head[a];
  head[a] = tot;
  tot++;
}
int du[205];
int fa[205];
int visp[205];
int find(int x) {
  if (fa[x] == x) return x;
  return fa[x] = find(fa[x]);
}
vector<int> vec;
int ans;
void dfs(int x) {
  for (int k = head[x]; k != -1; k = data[k].next)
    if (!data[k].flag1 && !data[k ^ 1].flag1) {
      data[k].flag1 = 1;
      dfs(data[k].tov);
    }
}
void init() {
  memset(du, 0, sizeof(du));
  memset(visp, 0, sizeof(visp));
  memset(data, 0, sizeof(data));
  memset(head, -1, sizeof(head));
  tot = 0;
  ans = 0;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    init();
    cin >> n >> m;
    for (int i = 1; i <= n; i++) fa[i] = i;
    for (int i = 1; i <= m; i++) {
      int x, y;
      cin >> x >> y;
      insert(x, y, 1);
      insert(y, x, 1);
      du[x]++;
      du[y]++;
      int fx = find(x);
      int fy = find(y);
      fa[fx] = fy;
    }
    for (int i = 1; i <= n; i++)
      if ((du[i] & 1) == 0) ans++;
    cout << ans << endl;
    for (int i = 1; i <= n; i++)
      if (!visp[find(i)]) {
        visp[find(i)] = 1;
        vec.clear();
        for (int j = 1; j <= n; j++)
          if (find(j) == find(i)) vec.push_back(j);
        vector<int> now;
        now.clear();
        for (int j = 0; j < vec.size(); j++)
          if (du[vec[j]] & 1) {
            now.push_back(vec[j]);
          }
        for (int j = 0; j < now.size(); j += 2) {
          insert(now[j], now[j + 1], 0);
          insert(now[j + 1], now[j], 0);
        }
        dfs(i);
        for (int j = 0; j < vec.size(); j++) {
          for (int k = head[vec[j]]; k != -1; k = data[k].next) {
            if (data[k].flag && data[k].flag1) {
              cout << vec[j] << " " << data[k].tov << endl;
            }
          }
        }
      }
  }
  return 0;
}
