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