#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    string a;
    vector<char> s;
    cin >> a;
    s.push_back(a[0]);
    for (int i = 1; i < a.length() - 1; ++i) {
      if (a[i] == a[i + 1]) {
        s.push_back(a[i]);
        i++;
      }
    }
    s.push_back(a[a.size() - 1]);
    for (int j = 0; j < s.size(); ++j) {
      cout << s[j];
    }
    cout << endl;
  }
  return 0;
}
