Broken Sequence

아직 제출이 없습니다시간 제한4초메모리 제한64 MB

문제

Let XX be a sequence (x_1,x_2,,x_n)(x\_1, x\_2, \dots , x\_n). Then the nonperiodic autocorrelation function N_X(s)N\_X(s) is: N_X(s)=_i=x_ix_i+s,N\_X(s) = \sum\_{i=-\infty}^{\infty} x\_i x\_{i+s}, where ss is an integer. Here we assume that x_i=0x\_i=0 for i<1i<1 and i>ni>n.

Consider four sequences (A,B,C,D)(A,B,C,D) of length nn, nn, nn, and n1n-1 correspondingly, all elements of which are from set 1,+1\\{ -1, +1 \\}. These four sequences form the TTTT-sequence (Turyn-Type sequence) if and only if N_A(s)+N_B(s)+2N_C(s)+2N_D(s)=0, for all integer s>0.N\_A(s) + N\_B(s) + 2N\_C(s) + 2N\_D(s) = 0,\text{ for all integer }s>0.

TTTT-sequences are very interesting because they allow building Hadamard matrices which find applications in such fields as signal processing and coding theory. For example, a TTTT-sequence for n=36n=36 (which has been found in 2005) allowed to construct a Hadamard matrix of order 428428 for the first time.

Given a TTTT-sequence where several elements are missing, restore the initial TTTT-sequence.

입력

The four lines contain four strings of length nn, nn, nn and n1n-1 (2n362 \le n \le 36, nn is even) which encode sequences AA, BB, CC and DD. The ii-th symbol encodes the ii-th element of the corresponding sequence. "-" denotes 1-1, "+" denotes +1+1, and "?" denotes a missing element. The total number of the missing elements does not exceed 3030.

It is guaranteed that for the given data a single solution exists.

출력

Output four strings of length nn, nn, nn and n1n-1 --- the restored TTTT-sequence. See samples for better understanding of output format.