
ZOJ Problem Set  2707
In the eighth grade of the high school students learn how to solve systems of linear equations. This time you have to solve the system of two linear equations with two unknowns in polynomials over F_{2} . That is, both coefficients and variables are polynomials with coefficients from F_{2} = {0, 1} , operations in this field are carried out modulo 2. Given polynomials a_{1}(t) , b_{1}(t) , c_{1}(t) , a_{2}(t) , b_{2}(t) , and c_{2}(t) , find polynomials x(t) and y(t) , such that:
Input There are mutiple cases in the input file. Six lines of each case describe polynomials a_{1}(t) , b_{1}(t) , c_{1}(t) , a_{2}(t) , b_{2}(t) , and c_{2}(t) in this order. Each polynomial is specified with its degree k followed by k+1 coefficients, starting from the leading one. Each coefficient is either 0 , or 1 . Constant zero polynomial has the degree of 1 in this problem. Degrees of the polynomials do not exceed 100 . There is an empty line after each case. Output Output two polynomials, one on a line  x(t) and y(t) . Use the same format as in input. If there is no solution to the system of the equations, output “No solution” instead. If there are several solutions, output any one with the degree not exceeding 1000 (it can be proved that if there is some solution, there is such one). There should be am empty line after each case.Sample Input 1 1 0 0 1 3 1 1 0 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 Sample Output 2 1 0 1 2 1 1 0 0 1 0 1 No solution Source: Andrew Stankevich's Contest #10 