#include <bits/stdc++.h>
void quit();
using namespace std;
const long double PI = acos(-1);
const long double EPS = 1e-10;
double __t;
int n, m;
int g[202][202];
bool start[202][202];
int u[202];
int deg[202];
vector<int> ec;
bool compUsed[202];
int cur;
vector<int> odd[202];
void dfs(int v) {
  u[v] = cur;
  for (int i = 0; i < n; ++i) {
    if (g[v][i] > 0 && u[i] == 0) {
      dfs(i);
    }
  }
}
inline void addEdge(int v, int w) {
  g[v][w]++;
  g[w][v]++;
}
inline void delEdge(int v, int w) {
  g[v][w]--;
  g[w][v]--;
}
void euler(int v) {
  for (int i = 0; i < n; ++i) {
    if (g[v][i] > 0 && u[i] == u[v]) {
      delEdge(v, i);
      euler(i);
    }
  }
  ec.push_back(v);
}
inline void init() {
  memset(u, 0, sizeof(u));
  memset(deg, 0, sizeof(deg));
  memset(g, 0, sizeof(g));
  memset(start, 0, sizeof(start));
  memset(compUsed, 0, sizeof(compUsed));
  for (int i = 0; i < 202; ++i) odd[i].clear();
  cur = 0;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int T;
  cin >> T;
  for (int test = 0; test < T; ++test) {
    cin >> n >> m;
    init();
    int v, w;
    for (int i = 0; i < m; ++i) {
      cin >> v >> w;
      --v;
      --w;
      addEdge(v, w);
      start[v][w] = start[w][v] = 1;
      deg[v]++;
      deg[w]++;
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
      if (deg[i] % 2 == 0) {
        ++ans;
      }
    }
    cout << ans << '\n';
    for (int i = 0; i < n; ++i) {
      if (!u[i]) {
        ++cur;
        dfs(i);
      }
    }
    for (int i = 0; i < n; ++i) {
      if (deg[i] & 1) {
        odd[u[i]].push_back(i);
      }
    }
    for (int i = 1; i <= cur; ++i) {
      for (int j = 0; j < (int)odd[i].size(); j += 2) {
        addEdge(odd[i][j], odd[i][j + 1]);
      }
    }
    for (int i = 0; i < n; ++i) {
      if (compUsed[u[i]]) continue;
      ec.clear();
      euler(i);
      for (int j = 0; j < (int)ec.size() - 1; ++j) {
        if (start[ec[j]][ec[j + 1]]) {
          cout << ec[j] + 1 << ' ' << ec[j + 1] + 1 << '\n';
          start[ec[j]][ec[j + 1]] = 0;
          start[ec[j + 1]][ec[j]] = 0;
        }
      }
      if (start[ec.back()][ec[0]]) {
        cout << ec.back() + 1 << ' ' << ec[0] + 1 << '\n';
        start[ec.back()][ec[0]] = 0;
        start[ec[0]][ec.back()] = 0;
      }
      compUsed[u[i]] = 1;
    }
  }
  quit();
}
void quit() { exit(0); }
