提交统计

做了此题的人还做了哪些题

Special particles

时间限制:1000 ms  |  内存限制:65535 KB
难度:3
描述

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-".


 

输入
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

输出
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".
样例输入
2
1 0 1 0 3 1 0 0
1 1 1 1 1 1 1 2
样例输出
YES
NO
来源
Trinity
上传者
张洁烽