#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("-O3")
#pragma GCC optimize("-O2")
#pragma GCC optimize("-O1")
#pragma GCC optimize("-Os")
#pragma GCC optimize("-s")
#pragma GCC optimize("-O")
using namespace std;
mt19937_64 gen(time(0));
const long long N = 2e5 + 100;
const long long inf = 2e10;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    long long k = 1;
    for (long long i = 1; i < s.size(); ++i)
      if (s[i] == s[i - 1]) k++;
    if (k == s.size()) {
      cout << s << '\n';
      continue;
    }
    for (long long i = s.size() - 2; i >= 0; --i) {
      if (s[i] == s[i + 1]) {
        long long x = s[i] - '0';
        x = 1 - x;
        char c = x + '0';
        string y = "";
        y += c;
        s.insert(i + 1, y);
      }
    }
    cout << s << '\n';
  }
  return 0;
}
