#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma G++ optimize(2)
using namespace std;
const int N = 1E5 + 10;
int main() {
  string str;
  int t;
  int cnt[2];
  scanf("%d", &t);
  while (t--) {
    cin >> str;
    memset(cnt, 0, sizeof cnt);
    for (register int i = 1; i <= str.size(); ++i) {
      if (str[i - 1] == '0')
        cnt[0]++;
      else
        cnt[1]++;
    }
    if (cnt[0] == 0 || cnt[1] == 0) {
      cout << str << endl;
    } else {
      printf("%c", str[0]);
      for (register int i = 2; i <= str.size(); ++i) {
        if (str[i - 2] == str[i - 1]) {
          if (str[i - 2] == '0')
            printf("1");
          else
            printf("0");
        }
        printf("%c", str[i - 1]);
      }
      printf("\n");
    }
  }
  return 0;
}
