#include <cstdio>
#include <string>
#include <vector>
#include <cstdint>
#include <algorithm>

size_t gcd(size_t m, size_t n) {
  while (n) std::swap(m%=n, n);
  return m;
}

size_t lcm(size_t m, size_t n) {
  return m/gcd(m, n)*n;
}

std::vector<int> parse(const std::string &s) {
  std::vector<int> res;
  for (size_t i=0; i<s.length(); i+=2) {
    int cur=(s[i]-'0');
    cur <<= 4;
    cur |= (s[i+1]-'0');
    res.push_back(cur);
  }
  return res;
}

void compress(std::vector<int> &res) {
  std::vector<int> on;
  for (size_t i=0; i<res.size(); ++i)
    if (res[i])
      on.push_back(i);

  if (on.empty()) {
    res.assign(1, 0);
    return;
  }

  size_t div=res.size();
  for (size_t i=0; i<on.size(); ++i)
    div = gcd(div, on[i]);

  if (div == 1)
    return;

  std::vector<int> tmp(res.size()/div);
  for (size_t i=0; i<tmp.size(); ++i) {
    tmp[i] = res[div*i];
  }
  res = tmp;
}

void or_seq(std::vector<int> &res, const std::vector<int> &in) {
  size_t mul=res.size()/in.size();
  for (size_t i=0; i<in.size(); ++i) {
    res[mul*i] |= in[i];
  }
}

int solve_testcase() {
  size_t N;
  scanf("%zu", &N);

  std::vector<std::string> R(N);
  std::vector<std::vector<int>> T(N);
  for (size_t i=0; i<N; ++i) {
    char buf[2048+1];
    scanf("%s", buf);
    R[i] = buf;
    T[i] = parse(R[i]);
    compress(T[i]);
    // for (size_t j=0; j<T[i].size(); ++j)
    //   fprintf(stderr, "%d%c", T[i][j], j+1<T[i].size()? ' ':'\n');
  }

  size_t len=1;
  for (size_t i=0; i<N; ++i) {
    len = lcm(len, T[i].size());
    if (len > 1024)
      return !printf("Too complex.\n");
  }

  std::vector<int> res(len);
  for (size_t i=0; i<N; ++i)
    or_seq(res, T[i]);

  for (size_t i=0; i<len; ++i)
    printf("%02X", res[i]);

  printf("\n");
  return 0;
}

int main() {
  int T;
  scanf("%d", &T);

  for (int i=0; i<T; ++i)
    solve_testcase();
}

