#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    string ans = "";
    int st = 1;
    bool f = 0;
    for (int i = 1; i < s.size(); i++) {
      if (s[i] != s[i - 1]) {
        f = 1;
        break;
      }
    }
    if (!f) {
      cout << s << endl;
      continue;
    }
    ans += s[0];
    int n = s.size();
    int ind = 0;
    while (st < n) {
      char ase = ans[ind];
      char okon = s[st];
      if (ase != okon) {
        ans += s[st];
        st++;
        ind++;
      } else {
        if (ase == '0') {
          ans += '1';
          ans += '0';
          ind += 2;
          st++;
        } else {
          ans += '0';
          ans += '1';
          ind += 2;
          st++;
        }
      }
    }
    cout << ans << endl;
  }
}
