#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> v(n);
    for (long long i = 0; i < n; i++) cin >> v[i];
    long long X = v[0], S = v[0];
    for (long long i = 1; i < n; i++) X ^= v[i], S += v[i];
    long long elem = (1LL << 50) + S % 2;
    S += elem;
    X ^= elem;
    long long ans = 2 * X - S;
    cout << 3 << "\n"
         << elem << " " << ans / 2 << " " << ans / 2 << " " << endl;
  }
}
