#include <bits/stdc++.h>
using namespace std;
class algoritm {
  friend istream &operator>>(istream &, algoritm &);
  friend ostream &operator<<(ostream &, const algoritm &);

 public:
  void rezolvare() {
    cin.get();
    for (int i = 1; i <= n; i++) {
      string s;
      getline(cin, s);
      int nr1, nr2;
      nr1 = 0;
      nr2 = 0;
      for (int j = 0; j < s.size(); j++) {
        if (s[j] == '1') {
          nr1++;
        } else if (s[j] == '0') {
          nr2++;
        }
      }
      if (nr1 == s.size()) {
        cout << s << endl;
        continue;
      } else if (nr2 == s.size()) {
        cout << s << endl;
        continue;
      }
      for (int j = 0; j < s.size() - 1; j++) {
        if ((s[j] == '1' && s[j + 1] == '0') ||
            (s[j] == '1' && s[j + 1] == '0')) {
          continue;
        } else if (s[j] == '1' && s[j + 1] == '1') {
          s.insert(j + 1, "0");
        } else if (s[j] == '0' && s[j + 1] == '0') {
          s.insert(j + 1, "1");
        }
      }
      cout << s << endl;
    }
  }

 protected:
  int n;
};
ostream &operator<<(ostream &output, const algoritm &alg) { return output; }
istream &operator>>(istream &input, algoritm &alg) {
  input >> alg.n;
  return input;
}
int main() {
  algoritm alg;
  cin >> alg;
  alg.rezolvare();
}
