#P1414. Specialparticles

Specialparticles

With the development of physics,scientists have discovered more and more particles.Perhaps one day scientists will find a special kind of particles,because they must pairs of produce or disappear.

Now we need to design an experiment destroy all of the special particles.Experimental device is a eight camera cube,each camera occupies a vertex,Numbers for A,B,C····,H.

Each camera started all have a certain number of special particle, different cameras inside the number of special particles may be different.

Every time can choose between two neighboring vertex, let them simultaneously in a special particles produced or disappear.

For example: if eight cameras have 1,0,1,0,3,1,0,0,special particle,So a legitimate operation is "EF-,EA-,AD+,AE-,DC-".


 

Input

Frist line input N(1<N<10000),N says with multiple test data.
The N line input behind multiple input data, each group of input data has 8 digits, representing eight cameras A, B, C, · · · H, have special particles

Output

If the special particle inside camera can all disappear at last,then output"YES".
If the special particle inside camera can not all disappear at last,then output"NO".

Sample Input

2
1 0 1 0 3 1 0 0
1 1 1 1 1 1 1 2

Sample Output

YES
NO

HINT

Source