#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  while (n--) {
    string a = "", b = "";
    cin >> b;
    a += b[0];
    for (int i = 1; i < b.length() - 1; i++) {
      if (b[i] == b[i + 1]) {
        a += b[i];
        i++;
      } else {
        a += b[i];
        a += b[i + 1];
        i++;
      }
    }
    a += b[b.length() - 1];
    cout << a << endl;
  }
}
