#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, k, a[1000];
  vector<int> v;
  ifstream fin("input.txt");
  ofstream fout("output.txt");
  cin >> t;
  while (t--) {
    cin >> n;
    int s = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      s += a[i];
    }
    v.clear();
    if (s % 2 == 0) {
      for (int i = 0; i < n - 1; i++) {
        if (a[i] == 0 && a[i + 1] == 0) {
          v.push_back(0);
          v.push_back(0);
          i++;
        }
        if (a[i] == 1) v.push_back(1);
      }
      if (a[n - 1] == 1) v.push_back(a[n - 1]);
    } else {
      int k = 0;
      for (int i = 0; i < n - 1; i++) {
        if (a[i] == 0 && a[i + 1] == 0) {
          v.push_back(0);
          v.push_back(0);
          i++;
        }
        if (a[i] == 1) {
          k++;
          if (k != s) v.push_back(1);
        }
      }
      if (v.size() < n / 2) v.push_back(0);
    }
    cout << v.size() << endl;
    for (int i = 0; i < v.size(); i++) {
      cout << v[i] << " ";
    }
    cout << endl;
  }
}
