A LSU physics researcher who we will call "Sparky" was very successful in procuring funding for the physics department because of his breakthrough research into new 3-dimensional crystalline storage technology. Though a brilliant physicist, Sparky's organizational habits were lacking. His office was strewn with stacks of crystal pictures, and most were not labeled in any way other than to note the orientation of the crystal.
Unfortunately for the physics department, Sparky asphyxiated from laughter after a night grading midterms for his Physics For Non-Majors class. You are the lucky new non-tenured professor that has been hired by the Physics departement to decipher Sparky's research and keep that grant money flowing.
In Sparky's now vacant office, there is a mess of picutures all about. You know that he was taking three pictures of each crystal he grew (one picture down each primary axis: X,Y,Z). You also know that the crystals grew in a liquid suspension and therefore don't necessarily consist of a single continuous mass.
As a first step in organizing the mess you decide to take the pictures three at a time (one down each axis) and see whether or not they could be pictures of the same crystal. Of course, you know Sparky always took pictures of cubical areas, so you pick out pictures of the same dimensions before examining them.
Here are some other useful things that you know about the pictures:
Input to this problem will consist of a (non-empty) series of up to 100 data sets. Each data set will be formatted according to the following description, and there will be no blank lines separating data sets.
A single data set has five components:
For each data set, there will be exactly one line of output. This line will simply be the word "YES" or the word "NO" (all caps with no whitespace leading or following).
A "YES" line will appear only if there exists some solid 3-dimensional object that could project the given silhouettes. (In other words, these could all be pictures of the same crystal).
A "NO" line will be output for all data sets that fail to meet the criteria for a "YES" line.
START 1 O O O END START 3 XXX XOX XOX XXX XXX XXX XXX XXX XXX END START 7 XXXXXXX XXXXXXX XXXXXXX XXXXXXX XXXXXXX XXXXXXX XXXXXXX OOOOOOO OOOOOOO OOOOOOO OOOOOOO OOOOOOO OOOOOOO OOOOOOO XOOOOOO OXOOOOO OOXOOOO OOOXOOO OOOOXOO OOOOOXO OOOOOOX END
NO YES NO