#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    string ans = "";
    ans += s[0];
    for (int i = 1; i < s.length(); i++) {
      if (i == s.length() - 1) {
        ans += s[i];
        break;
      }
      if (s[i] == s[i + 1]) {
        ans += s[i];
        i++;
      }
    }
    cout << ans << endl;
  }
}
