#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, i, l;
  string s1, s2;
  cin >> s1;
  n = s1.size();
  if (n > 2) {
    for (i = 1; i < n; i++) {
      if (s1[i + 1] == s1[i]) {
        s1[i + 1] = '0';
        i++;
      }
    }
    for (i = 0; i < n; i++) {
      if (s1[i] != '0') cout << s1[i];
    }
    cout << "\n";
  } else
    cout << s1 << "\n";
}
int main() {
  long long a;
  cin >> a;
  while (a--) solve();
  return 0;
}
