#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using i2 = pair<int, int>;
const int N = 1009;
int A[N], nxt[N];
bool rem[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    int s = 0;
    for (int i = 1; i <= n; ++i) {
      cin >> A[i];
      s += A[i];
      rem[i] = false;
    }
    nxt[n] = n + 1;
    for (int i = n - 1; i >= 1; --i) {
      if (A[i + 1])
        nxt[i] = i + 1;
      else
        nxt[i] = nxt[i + 1];
    }
    int k = n;
    for (int i = 1; i <= n; ++i) {
      if (A[i]) {
        if (s & 1) {
          rem[i] = true;
          --k;
          --s;
        } else if ((nxt[i] - i) % 2 == 0) {
          rem[i + 1] = true;
          --k;
        }
      }
    }
    cout << k << "\n";
    for (int i = 1; i <= n; ++i) {
      if (!rem[i]) cout << A[i] << " ";
    }
    cout << "\n";
  }
  return 0;
}
