There are cube-shaped boxes of the same size, numbered . Each face of each box is colored either black or white.
The colors of the six faces of the -th box are denoted by , and , as shown in Figure E-1. Here, each of , and is either B or W, where B represents black and W represents white.
Figure E-1: Correspondence between the input and the faces of a box.
You are given queries. For each (), the -th query specifies two integers and .
Using all the boxes numbered , you would like to make a single tower of boxes by rotating each box and then stacking the boxes vertically. After the orientation of each box is determined, all boxes are placed so that their top and bottom faces are horizontal and their bases are exactly aligned. Thus, each of the four sides of the tower consists of exactly one face from each box.
A tower is called balanced if, on each of its four sides, the number of black faces is equal to the number of white faces.
For each (), determine whether it is possible to make a balanced tower using all the boxes numbered .
输入格式
The input consists of a single test case of the following format.
The first line contains two integers and (, ), representing the number of boxes and the number of queries, respectively.
For each (), the -th of the following lines contains the six characters , and , in this order and without spaces. Each character is either B or W and represents the color of the corresponding face of the -th box as shown in Figure E-1.
For each (), the -th of the following lines contains two integers and (), representing the range of boxes used in the -th query.
输出格式
Print lines.
For each (), print Yes on the -th line if it is possible to make a balanced tower using all the boxes numbered , and print No otherwise.