#include <iostream>
#include <string>
using namespace std;
// Function to remove characters at even positions
string removeEvenPositionChars(const string& str) {
string result;
for (size_t i = 1; i < str.size(); i += 2) {
result += str[i];
}
return result;
}
// Function to repeatedly remove even position characters until no even positions are left
string processString(const string& str) {
string result = str;
while (result.size() > 1) {
result = removeEvenPositionChars(result);
}
return result;
}
int main() {
int T;
cin >> T;
cin.ignore(); // Ignore the newline character after the integer input
while (T--) {
string S;
getline(cin, S);
string result = processString(S);
cout << result << endl;
}
return 0;
}