#include <bits/stdc++.h>
using namespace std;
long long T;
long long N;
long long A[100200];
long long psum;
long long xsum;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> T;
  for (long long t = 0; t < T; t++) {
    psum = xsum = 0;
    cin >> N;
    for (long long i = 0; i < N; i++) {
      cin >> A[i];
      psum += A[i];
      xsum ^= 2 * A[i];
    }
    long long n1 = 0;
    long long n2 = 0;
    long long n3 = 0;
    for (long long i = 0; i < 54; i++) {
      if ((1ll << i) & psum) {
        if ((1ll << i) & xsum) {
        } else {
          n3 += (1ll << i);
          psum += (1ll << i);
          xsum ^= (1ll << i + 1);
        }
      } else {
        if ((1ll << i) & xsum) {
          n1 += (1ll << i - 1);
          n2 += (1ll << i - 1);
          psum += (1ll << i);
        } else {
        }
      }
    }
    cout << "3\n" << n1 << " " << n2 << " " << n3 << "\n";
  }
  return 0;
}
