#include <bits/stdc++.h>
using namespace std;
const int M = 210;
int T, n, m;
set<int> s[M];
vector<pair<int, int> > ans;
void DFS(int x) {
  while (s[x].size()) {
    int p = *s[x].begin();
    s[x].erase(p);
    s[p].erase(x);
    ans.push_back(make_pair(x, p));
    DFS(p);
  }
}
int main() {
  scanf("%d", &T);
  while (T--) {
    ans.clear();
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= m; i++) {
      int x, y;
      scanf("%d%d", &x, &y);
      s[x].insert(y);
      s[y].insert(x);
    }
    for (int i = 1; i <= n; i++)
      if (s[i].size() % 2) {
        s[n + 1].insert(i);
        s[i].insert(n + 1);
      }
    printf("%d\n", n - s[n + 1].size());
    for (int i = 1; i <= n; i++) DFS(i);
    for (int i = 0; i < ans.size(); i++)
      if (ans[i].first != n + 1 && ans[i].second != n + 1)
        printf("%d %d\n", ans[i].first, ans[i].second);
  }
  return 0;
}
