#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cstring>
#include <iostream>
using namespace std;

int T;

int main() {
  cin >> T;
  for (int i = 1; i <= T; i++) {
    int n;
    cin>>n;
    int zeroCount = 0;
    for (int j=1; j<=n; j++) {
        int input;
        cin>>input;
        if (input==0) {
            zeroCount++;
        }
    }
    cout<<n-zeroCount<<endl;
    for (int j=1; j<=n; j++) {
        cout<<1<<" ";
    }
    cout<<endl;
  }
}