#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long T;
  cin >> T;
  while (T--) {
    string s;
    cin >> s;
    int z1 = 0, o1 = 0;
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == '0')
        z1++;
      else
        o1++;
    }
    if (z1 == s.length()) {
      cout << s << endl;
      continue;
    } else if (o1 == s.length()) {
      cout << s;
      for (int i = 0; i < s.length() - 1; i++) cout << 1;
      cout << endl;
      continue;
    }
    int z = 0, o = 0;
    vector<char> v;
    char curr = s[0];
    s[0] == '0' ? z = 1 : o = 1;
    for (int i = 1; i < s.length(); i++) {
      if (s[i] == curr)
        s[i] == '0' ? z++ : o++;
      else {
        int val;
        if (z)
          val = z;
        else
          val = o;
        for (int j = 0; j < val - 1; j++) {
          v.push_back(curr);
          v.push_back(curr ^ 1);
        }
        v.push_back(curr);
        z = 0;
        o = 0;
        curr = s[i];
        curr == '0' ? z = 1 : o = 1;
      }
    }
    if (z || o) {
      int val;
      if (z)
        val = z;
      else
        val = o;
      for (int j = 0; j < val - 1; j++) {
        v.push_back(curr);
        v.push_back(curr ^ 1);
      }
      v.push_back(curr);
    }
    for (auto x : v) cout << x;
    cout << endl;
  }
  return 0;
}
