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