#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  string s;
  for (int j = 0; j < t; j++) {
    cin >> s;
    int n = s.size();
    cout << s[0];
    for (int i = 1; i < n - 1; i++) {
      if (s[i] == s[i + 1]) {
        cout << s[i];
        i += 1;
      }
    }
    cout << s[n - 1];
    cout << endl;
  }
  return 0;
}
