#include <bits/stdc++.h>
using namespace std;
double low = 0, high = 0, mid = 0;
int binary_sear(const vector<int>& v, int x) {
  while (1) {
    mid = floor((low + high) / 2);
    if (low > high) break;
    if (v[mid] == x) {
      return mid;
      break;
    } else if (v[mid] < x) {
      low = mid + 1;
    } else {
      high = mid - 1;
    }
  }
  return -1;
}
int binary(vector<int> v, int x) {
  mid = floor((low + high) / 2);
  cout << low << " " << mid << " " << high << endl;
  if (low > high) return -1;
  if (v[mid] == x)
    return mid;
  else if (v[mid] < x) {
    low = mid + 1;
    return binary(v, x);
  } else {
    high = mid - 1;
    return binary(v, x);
  }
}
string decToBinary(int n) {
  string s = {};
  int i = 0;
  while (n > 0) {
    s += (n % 2) + 48;
    n = n / 2;
    i++;
  }
  reverse(s.begin(), s.end());
  return s;
}
int main() {
  long long int a, b = 0, c = 1, n, m, mx = 0, mn = 0;
  vector<int> v;
  bool flag = true, flag2 = true;
  cin >> n;
  while (n--) {
    cin >> m;
    for (int i = 0; i < m; i++) {
      cin >> a;
      if (i == 0) {
        b = a;
        c = a;
        continue;
      }
      b += a;
      c ^= a;
    }
    if (c * 2 == b)
      cout << 0 << endl << endl;
    else {
      mx = c;
      c ^= c;
      b += mx;
      c ^= b;
      mn = b;
      b += b;
      cout << 2 << endl;
      cout << mx << " " << mn << endl;
    }
    b = 0;
    c = 1;
  }
  return 0;
}
