#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long T;
  cin >> T;
  while (T--) {
    long long n;
    cin >> n;
    long long sum = 0;
    long long xxor = 0;
    for (long long i = 0; i < n; ++i) {
      long long val;
      cin >> val;
      sum += val;
      xxor ^= val;
    }
    long long n1 = ((1ll << 50) - 1) ^ xxor;
    if ((sum + n1) & 1) n1 ^= 1;
    long long sum2 = sum + n1;
    long long xor2 = xxor ^ n1;
    long long n2 = (2 * xor2 - sum2) / 2;
    cout << 3 << endl;
    cout << n1 << " " << n2 << " " << n2 << endl;
  }
}
