#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar()) {
    if (ch == '-') f = -1;
  }
  for (; isdigit(ch); ch = getchar()) {
    x = x * 10 + ch - 48;
  }
  return x * f;
}
const int N = 1e5;
const long long X = 1000000000000000ll;
int n;
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    long long a = 0ll, b = 0ll;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
      long long x;
      scanf("%I64d", &x);
      a += x, b ^= x;
    }
    long long x, y;
    if (a & 1ll) {
      y = b ^ X;
      x = (X)*2ll - a;
    } else {
      y = b ^ (X);
      x = (X)*2ll - a;
    }
    printf("%d\n%I64d %I64d %I64d\n", 3, (x - y) / 2ll, (x - y) / 2ll, y);
  }
  return 0;
}
