#include <bits/stdc++.h>
using namespace std;
int n, te, num;
const int maxn = 300 + 10;
bool seen[maxn], check[maxn][maxn];
vector<int> vec[maxn], tour;
void dfs(int cur) {
  if (!seen[cur]) te++;
  seen[cur] = 1;
  for (int i = 0; i < (int)vec[cur].size(); i++) {
    int nei = vec[cur][i];
    if (!check[cur][nei]) {
      check[cur][nei] = 1;
      check[nei][cur] = 1;
      dfs(nei);
    }
  }
  tour.push_back(cur);
}
void pre() {
  for (int i = 1; i <= n + 1; i++) {
    for (int j = 0; j < (int)vec[i].size(); j++) check[i][vec[i][j]] = 0;
    vec[i].clear();
    seen[i] = 0;
  }
  te = 0;
  num = 0;
  tour.clear();
}
int main() {
  int m, f, g, t;
  cin >> t;
  for (int tt = 0; tt < t; tt++) {
    cin >> n >> m;
    pre();
    for (int i = 0; i < m; i++) {
      cin >> f >> g;
      vec[g].push_back(f);
      vec[f].push_back(g);
    }
    for (int i = 1; i <= n; i++) {
      if ((int)vec[i].size() % 2 == 1) {
        vec[i].push_back(n + 1);
        vec[n + 1].push_back(i);
      } else
        num++;
    }
    int cnt = 1;
    while (te < n) {
      while (seen[cnt]) cnt++;
      dfs(cnt);
      tour.push_back(n + 1);
    }
    cout << num << endl;
    for (int i = 0; i < (int)tour.size(); i++) {
      if (tour[i] != n + 1 && tour[i + 1] != n + 1)
        cout << tour[i] << " " << tour[i + 1] << endl;
    }
  }
}
