#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<int> nums(n, 0);
    for (long long i = 0; i < n; i++) {
      cin >> nums[i];
    }
    int sum = 0, ones = 0, last;
    for (int i = 0; i < n; i++) {
      if (nums[i]) {
        ones++;
        last = i;
      }
    }
    if (ones % 2) nums.erase(nums.begin() + last);
    last = -1;
    vector<bool> removed(nums.size(), false);
    for (int i = 0; i < nums.size(); i++) {
      if (nums[i] == 1) {
        if (last != -1 && !((i - last) % 2)) {
          removed[i - 1] = true;
          sum++;
        }
        last = i;
      }
    }
    cout << nums.size() - sum << "\n";
    for (int i = 0; i < nums.size(); i++)
      if (!removed[i]) cout << nums[i] << " ";
    cout << "\n";
  }
}
