#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int l = s.length();
    int t = 1;
    for (int i = 0; i < l - 1; i++) {
      if (s[i] != s[i + 1]) t = 2;
    }
    for (int i = 0; i < l - 2; i++) {
      if (l != 2 && s[i] != s[i + 2]) t = 3;
    }
    int la = 0;
    char ans[200];
    if (t == 3) {
      for (int i = 0; i < l - 1; ++i) {
        ans[la++] = s[i];
        if (s[i + 1] == s[i]) {
          if (s[i] == '0')
            ans[la++] = '1';
          else
            ans[la++] = '0';
        }
      }
      ans[la++] = s[l - 1];
      for (int i = 0; i < la; ++i) cout << ans[i];
      cout << endl;
    } else
      cout << s << endl;
  }
  return 0;
}
