#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> G(n + 1, vector<int>(n + 1, 0));
    vector<int> deg(n + 1);
    for (int i = 0; i < m; i++) {
      int u, v;
      cin >> u >> v;
      G[u][v] = G[v][u] = 1;
      deg[u]++;
      deg[v]++;
    }
    int neve = 0;
    for (int i = 1; i <= n; i++) {
      if (deg[i] & 1) {
        G[0][i] = G[i][0] = 1;
      } else
        neve++;
    }
    vector<int> vis(n + 1, 0);
    vector<vector<int>> ans;
    for (int i = 0; i <= n; i++) {
      if (!vis[i]) {
        vector<int> st, path;
        st.push_back(i);
        while (!st.empty()) {
          int nd = st.back();
          int id = 0;
          for (; id <= n && !G[nd][id]; id++)
            ;
          if (id == n + 1) {
            path.push_back(nd);
            st.pop_back();
          } else {
            G[nd][id] = G[id][nd] = 0;
            st.push_back(id);
          }
        }
        ans.push_back(path);
        for (int j = 0; j < (int)path.size(); j++) {
          vis[i] = 1;
        }
      }
    }
    cout << neve << '\n';
    for (int i = 0; i < (int)ans.size(); i++) {
      for (int j = 0; j < (int)ans[i].size() - 1; j++) {
        if (ans[i][j] && ans[i][j + 1]) {
          cout << ans[i][j] << ' ' << ans[i][j + 1] << '\n';
        }
      }
    }
  }
  return 0;
}
