#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  for (int e = 0; e < q; e++) {
    int n;
    cin >> n;
    vector<long long> a(n);
    long long sum = 0;
    long long bit = -1;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      sum += a[i];
      if (!i) {
        bit = a[i];
      } else {
        bit ^= a[i];
      }
    }
    cout << "2\n" << sum + bit << " " << bit << "\n";
  }
}
