#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    long long n = s.length();
    long long max_diff1 = 0;
    long long max_diff2 = 0;
    long long prev_0 = -1, next_0 = -1;
    long long prev_1 = -1, next_1 = -1;
    for (long long i = 0; i < n; i++) {
      if (s[i] == '0') {
        if (prev_0 == -1) {
          prev_0 = i;
        } else {
          if (next_0 == -1) {
            next_0 = i;
            max_diff1 = max(max_diff1, next_0 - prev_0);
          } else {
            prev_0 = next_0;
            next_0 = i;
            max_diff1 = max(max_diff1, next_0 - prev_0);
          }
        }
      } else {
        if (prev_1 == -1) {
          prev_1 = i;
          max_diff2 = max(max_diff2, next_1 - prev_1);
        } else {
          if (next_1 == -1) {
            next_1 = i;
          } else {
            prev_1 = next_1;
            next_1 = i;
            max_diff2 = max(max_diff2, next_1 - prev_1);
          }
        }
      }
    }
    if (prev_0 == -1 || prev_1 == -1)
      cout << s << endl;
    else if (next_0 == -1 && next_1 == -1)
      cout << s << endl;
    else {
      vector<char> ans;
      for (long long i = 0; i < n; i++) {
        if (s[i] == '0') {
          ans.push_back(s[i]);
          if (i + 1 < n && s[i + 1] == '0') ans.push_back('1');
        } else {
          ans.push_back(s[i]);
          if (i + 1 < n && s[i + 1] == '1') ans.push_back('0');
        }
      }
      for (long long i = 0; i < ans.size(); i++) cout << ans[i];
      cout << endl;
    }
  }
}
