#include #include #include #include #include #include using namespace std; char s1[55], s2[55]; int l1, l2; int main (){ int i, j, k, T; char c; scanf ( "%d\n", &T ); while ( T -- ){ l1 = l2 = 0; i = 0; while ( scanf ( "%c", &c ) && c != '\n' ){ i ++; if ( ( i & 1 ) == 0 ) s2[++l2] = c; else s1[++l1] = c; } for ( i = 1; i <= l1; i ++ ) printf ( "%c", s1[i] ); printf ( "\n" ); for ( i = l2; i >= 1; i -- ) printf ( "%c", s2[i] ); printf ( "\n" ); } return 0; }