#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define INF 0x3f3f3f3f #define inf (-((LL)1<<40)) #define lson k<<1, L, (L + R)>>1 #define rson k<<1|1, ((L + R)>>1) + 1, R #define mem0(a) memset(a,0,sizeof(a)) #define mem1(a) memset(a,-1,sizeof(a)) #define mem(a, b) memset(a, b, sizeof(a)) #define FIN freopen("in.txt", "r", stdin) #define FOUT freopen("out.txt", "w", stdout) #define rep(i, a, b) for(int i = a; i <= b; i ++) #define dec(i, a, b) for(int i = a; i >= b; i --) template T MAX(T a, T b) { return a > b ? a : b; } template T MIN(T a, T b) { return a < b ? a : b; } template T GCD(T a, T b) { return b ? GCD(b, a%b) : a; } template T LCM(T a, T b) { return a / GCD(a,b) * b; } //typedef __int64 LL; typedef long long LL; const int MAXN = 51000; const int MAXM = 110000; const double eps = 1e-8; LL MOD = 1000000007; char s[110000]; int main() { // FIN; int T; scanf("%d%*c", &T); while(T--) { gets(s); int len = strlen(s); for(int i = 0; i < len; i += 2) printf("%c", s[i]); puts(""); for(int i = len - 1; i >= 0; i -= 2) printf("%c", s[i]); puts(""); } return 0; }