#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  long long a[n], e, o = 0, h = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    if (i % 2 == 0 && a[i] == 1)
      e++, h++;
    else if (i % 2 == 1 && a[i] == 1)
      o++, h++;
  }
  if (h <= n / 2) {
    cout << n - h << "\n";
    for (long long int i = 0; i < n; i++)
      if (a[i] == 0) cout << 0 << " ";
  } else {
    if (h % 2) h--;
    cout << h << "\n";
    for (long long int i = 0; i < n; i++)
      if (a[i] && h) cout << a[i] << " ", h--;
  }
  cout << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long test_cases = 1;
  cin >> test_cases;
  for (long long t = 1; t <= test_cases; t++) solve();
  return 0;
}
