The Little Elephant loves chess very much. 

One day the Little Elephant and his friend decided to play chess. They've got the chess pieces but the board is a problem. They've got an 8 × 8 checkered board, each square is painted either black or white. The Little Elephant and his friend know that a proper chessboard doesn't have any side-adjacent cells with the same color and the upper left cell is white. To play chess, they want to make the board they have a proper chessboard. For that the friends can choose any row of the board and cyclically shift the cells of the chosen row, that is, put the last (rightmost) square on the first place in the row and shift the others one position to the right. You can run the described operation multiple times (or not run it at all).

For example, if the first line of the board looks like that "BBBBBBWW" (the white cells of the line are marked with character "W", the black cells are marked with character "B"), then after one cyclic shift it will look like that "WBBBBBBW".

Help the Little Elephant and his friend to find out whether they can use any number of the described operations to turn the board they have into a proper chessboard.


-----Input-----

The input consists of exactly eight lines. Each line contains exactly eight characters "W" or "B" without any spaces: the j-th character in the i-th line stands for the color of the j-th cell of the i-th row of the elephants' board. Character "W" stands for the white color, character "B" stands for the black color.

Consider the rows of the board numbered from 1 to 8 from top to bottom, and the columns — from 1 to 8 from left to right. The given board can initially be a proper chessboard.


-----Output-----

In a single line print "YES" (without the quotes), if we can make the board a proper chessboard and "NO" (without the quotes) otherwise.


-----Examples-----
Input
WBWBWBWB
BWBWBWBW
BWBWBWBW
BWBWBWBW
WBWBWBWB
WBWBWBWB
BWBWBWBW
WBWBWBWB

Output
YES

Input
WBWBWBWB
WBWBWBWB
BBWBWWWB
BWBWBWBW
BWBWBWBW
BWBWBWWW
BWBWBWBW
BWBWBWBW

Output
NO



-----Note-----

In the first sample you should shift the following lines one position to the right: the 3-rd, the 6-th, the 7-th and the 8-th.

In the second sample there is no way you can achieve the goal.

Source: codeforces | Difficulty: EASY
Tags: String algorithms

Complete search


Solutions:
n = 8
s = ''
for i in range(n):
	s += input() + ','
if s.count('WBWBWBWB') + s.count('BWBWBWBW') != 8:
	print('NO')
else:
	print('YES')


for i in range(8):
	a = input()
	if a[0] == a[-1] or 'WW' in a or 'BB' in a:
		print('NO')
		exit(0)
print('YES')


res = 'YES'
for i in range(8):
	s = input()
	if s != 'BWBWBWBW' and s != 'WBWBWBWB':
		res = 'NO'
print(res)


def main():
	ok = 1
	for i in range(8):
		row = input()
		if row != 'WBWBWBWB' and row != 'BWBWBWBW':
			ok = 0
	print('YES' if ok else 'NO')
main()


possible = True
(pw, pb) = (False, False)
for i in range(8):
	line = input()
	count = 0
	c = 1
	(cw, cb) = (False, False)
	if not possible:
		continue
	for i in range(1, 8):
		if line[i] == line[i - 1]:
			c += 1
			if line[i] == 'W':
				cw = True
			elif line[i] == 'B':
				cb = True
		else:
			if c > 1:
				count += 1
			c = 1
		if c >= 3:
			possible = False
			break
	if c > 2:
		possible = False
	if c >= 2:
		count += 1
	if count >= 2:
		possible = False
	if cw and pw:
		possible = False
	if cb and pb:
		possible = False
	pw = cw
	pb = cb
if possible:
	print('YES')
else:
	print('NO')


3

def readln():
	return tuple(map(int, input().split()))
print('YES' if len([1 for _ in range(8) if input() in ['WB' * 4, 'BW' * 4]]) == 8 else 'NO')


ar = []
for i in range(8):
	st = input()
	ar.append(st)
for i in ar:
	curr = i[0]
	ch = 0
	for j in range(1, len(i)):
		if i[j] == curr:
			ch = 1
			print('NO')
			break
		else:
			curr = i[j]
	if ch == 1:
		break
if ch != 1:
	print('YES')


x = []
for i in range(8):
	s = str(input())
	x.append(s)
d = False
for i in range(8):
	s = x[i]
	if s == 'BWBWBWBW' or s == 'WBWBWBWB':
		continue
	else:
		d = True
		print('NO')
		break
if d == False:
	print('YES')


cnt = 0
for i in range(8):
	s = input()
	if s == 'WB' * 4 or s == 'BW' * 4:
		cnt += 1
if cnt == 8:
	print('YES')
else:
	print('NO')


def main():
	table = []
	for _ in range(8):
		table.append(input())
	for i in range(8):
		whites = table[i].count('W')
		blacks = 8 - whites
		if whites != 4:
			print('NO')
			return
		for j in range(8):
			if table[i][j] == table[i][(j + 1) % 8]:
				print('NO')
				return
	print('YES')
main()


def check(board):
	for s in board:
		for i in range(len(s)):
			if s[i] == s[(i + 1) % 8]:
				print('NO')
				return
	print('YES')
board = [input() for i in range(8)]
check(board)


z = False
for _ in range(8):
	k = input()
	for x in range(7):
		if k[x] == k[x + 1]:
			print('NO')
			z = True
			break
	if z == True:
		break
else:
	print('YES')


for i in range(8):
	r = input()
	if r != 'WBWBWBWB' and r != 'BWBWBWBW':
		print('NO')
		return
print('YES')


l = []
a = 'WBWBWBWB'
b = 'BWBWBWBW'
f = 0
for i in range(8):
	s = input()
	if s != a and s != b:
		f = 1
if f == 1:
	print('NO')
else:
	print('YES')


for i in range(8):
	a = input()
	if a.find('BB') > -1:
		print('NO')
		exit()
	if a.find('WW') > -1:
		print('NO')
		exit()
print('YES')


q = True
for i in range(8):
	n = input()
	if n != 'WBWBWBWB' and n != 'BWBWBWBW':
		q = False
if q == True:
	print('YES')
else:
	print('NO')


def check(s):
	x = s[0:len(s):2]
	y = s[1:len(s):2]
	X = 'W' * 4
	Y = 'B' * 4
	if x == X and y == Y or (x == Y and y == X):
		return True
	return False
f = 0
for _ in range(8):
	s = input()
	if check(s):
		continue
	else:
		f = 1
		break
if f:
	print('NO')
else:
	print('YES')


list = []
for i in range(0, 8):
	line = input()
	list.append(line)
count = 0
for p in list:
	if p == 'BWBWBWBW' or p == 'WBWBWBWB':
		count += 1
if count == 8:
	print('YES')
else:
	print('NO')


flag = False
for _ in range(8):
	line = str(input())
	if line not in ('WBWBWBWB', 'BWBWBWBW'):
		flag = True
		break
print('NO') if flag else print('YES')


ans = 'YES'
for i in range(8):
	row = input()
	for j in range(7):
		if row[j] == row[j + 1]:
			ans = 'NO'
print(ans)


for i in range(8):
	s = input()
	for (a, b) in zip(s, (s + s[0])[1:]):
		if a == b:
			print('NO')
			exit(0)
print('YES')


def main():
	grid = [input() for _ in range(8)]
	for row in grid:
		if not (row == 'WB' * 4 or row == 'BW' * 4):
			print('NO')
			break
	else:
		print('YES')
main()


arr = []
for i in range(8):
	k = input()
	arr.append(k)
for i in range(8):
	if arr[i] == 'WBWBWBWB' or arr[i] == 'BWBWBWBW':
		ans = 'YES'
	else:
		ans = 'NO'
		break
print(ans)


ch = True
for i in range(8):
	l = input()
	if l in 'BWBWBWBW' or l in 'WBWBWBWB':
		pass
	else:
		print('NO')
		ch = False
		break
if ch:
	print('YES')


import math
from math import gcd, floor, sqrt, log

def iin():
	return int(input())

def sin():
	return input().strip()

def listin():
	return list(map(int, input().strip().split()))

def liststr():
	return list(map(str, input().strip().split()))

def ceill(x):
	return int(x) if x == int(x) else int(x) + 1

def ceilldiv(x, d):
	return x // d if x % d == 0 else x // d + 1

def LCM(a, b):
	return a * b // gcd(a, b)
ok = 1
for i in range(8):
	x = sin()
	if x[0] == x[-1] or 'WW' in x or 'BB' in x:
		print('NO')
		ok = 0
		break
if ok:
	print('YES')


arr = []
for _ in range(8):
	s = input()
	arr.append(s)
flag = 0
for i in range(8):
	for j in range(1, len(arr[i])):
		if arr[i][j - 1] == arr[i][j]:
			flag = 1
			break
	if arr[i][0] == arr[i][-1]:
		flag = 1
	if flag == 1:
		break
if flag == 1:
	print('NO')
else:
	print('YES')


l = []
f = 0
for i in range(8):
	l.append(input())
for i in range(8):
	for j in range(8):
		if l[i][j % 8] == l[i][(j + 1) % 8] == l[i][(j + 2) % 8]:
			f = 1
		elif j <= 6 and l[i][j] == l[i][j + 1]:
			f = 1
if f == 1:
	print('NO')
else:
	print('YES')


flag = True
for t in range(8):
	s = input()
	for i in range(len(s) - 1):
		if s[i] == s[i + 1]:
			flag = False
if flag:
	print('YES')
else:
	print('NO')


from re import *

def main():
	mode = 'filee'
	if mode == 'file':
		f = open('test.txt', 'r')
	get = lambda : [f.readline()[:-1] if mode == 'file' else input()]
	for z in range(8):
		q = get()
		q = q[0]
		if search('BB', q) != None or search('WW', q) != None:
			print('NO')
			return
	print('YES')
	if mode == 'file':
		f.close()

def __starting_point():
	main()
__starting_point()


try:
	c = 0
	for i in range(8):
		s = input()
		if s == 'WBWBWBWB' or s == 'BWBWBWBW':
			pass
		else:
			c = 1
	if c == 0:
		print('YES')
	else:
		print('NO')
except EOFError:
	pass


check = True
for i in range(8):
	s = input()
	for j in range(1, len(s)):
		if s[j] == s[j - 1]:
			check = False
			break
if check:
	print('YES')
else:
	print('NO')


i = 0
flag = 0
while i < 8:
	s = input()
	if s[0] == 'W':
		cur = 'W'
	else:
		cur = 'B'
	for j in s:
		if cur != j:
			flag = -1
		elif j == cur and j == 'W':
			cur = 'B'
		else:
			cur = 'W'
	i += 1
if flag != -1:
	print('YES')
else:
	print('NO')


for _ in range(8):
	s = input()
	if s == 'WB' * 4 or s == 'BW' * 4:
		continue
	else:
		print('NO')
		exit()
print('YES')


l = []
for i in range(8):
	tmp = input()
	l.append(tmp[:])
ok = 1
yes = 1
for i in range(8):
	if i % 2 == 0 and l[i][0] == 'B':
		ok = 0
	elif i % 2 == 1 and l[i][0] == 'W':
		ok = 0
	for j in range(1, 8):
		if l[i][j] == l[i][j - 1]:
			yes = 0
			break
	if yes == 0:
		break
if yes == 1 and ok == 0:
	print('YES')
else:
	print('NO')


import math
import sys
import collections

def getdict(n):
	d = {}
	if type(n) is list:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)
print('NO') if any((input() not in {'WBWBWBWB', 'BWBWBWBW'} for i in range(8))) else print('YES')


print('YES' if all([r == 'WB' * 4 or r == 'BW' * 4 for r in [input() for _ in range(8)]]) else 'NO')


def proper(string1):
	a = 'WBWBWBWB'
	b = 'BWBWBWBW'
	if string1 == a or string1 == b:
		return True
	return False

def checkProper(list1):
	for item in list1:
		res = proper(item)
		if res == False:
			return 'No'
	return 'Yes'
n = 8
list1 = []
while n:
	string1 = input()
	list1.append(string1)
	n -= 1
ans = checkProper(list1)
print(ans)


arr = []
for i in range(8):
	arr.append(input())
for i in arr:
	if 'WW' in i or 'BB' in i:
		print('NO')
		exit()
print('YES')


bad = False
for i in range(8):
	row = input().strip()
	if row not in ('WBWBWBWB', 'BWBWBWBW'):
		bad = True
if bad:
	print('NO')
else:
	print('YES')


def good(s):
	for i in range(7, -1, -1):
		if s[i] == s[i - 1]:
			return False
	return True
for i in range(8):
	if not good(input()):
		print('NO')
		exit()
print('YES')


import os
import sys
import math
from io import BytesIO, IOBase
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def dijkstra(start, distance, path, n):
	visited = [False for _ in range(n)]
	distance[start] = 0
	for i in range(n):
		v = -1
		for j in range(n):
			if not visited[v] and (v == -1 or distance[j] < distance[v]):
				v = j
		if distance[v] == math.inf:
			break
		visited[v] = True
		for edge in adj[v]:
			destination = edge[0]
			weight = edge[1]
			if distance[v] + weight < distance[destination]:
				distance[destination] = distance[v] + weight
				path[destination] = v

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def ncr(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def npr(n, r):
	return math.factorial(n) // math.factorial(n - r)

def seive(n):
	primes = [True] * (n + 1)
	ans = []
	for i in range(2, n):
		if not primes[i]:
			continue
		j = 2 * i
		while j <= n:
			primes[j] = False
			j += i
	for p in range(2, n + 1):
		if primes[p]:
			ans += [p]
	return ans

def factors(n):
	factors = []
	x = 1
	while x * x <= n:
		if n % x == 0:
			if n // x == x:
				factors.append(x)
			else:
				factors.append(x)
				factors.append(n // x)
		x += 1
	return factors

def main():
	try:
		board = []
		for _ in range(8):
			board.append(list(input()))
		for i in range(8):
			if i & 1 and board[i][0] != 'B' or (not i & 1 and board[i][0] != 'W'):
				board[i] = board[i][1:] + [board[i][0]]
		if board != [list('WBWBWBWB'), list('BWBWBWBW'), list('WBWBWBWB'), list('BWBWBWBW'), list('WBWBWBWB'), list('BWBWBWBW'), list('WBWBWBWB'), list('BWBWBWBW')]:
			print('NO')
		else:
			print('YES')
	except Exception as e:
		print(e)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def main():
	for _ in range(8):
		s = input()
		if not s[::2] == s[0] * 4 != s[1] * 4 == s[1::2]:
			print('NO')
			return
	print('YES')
main()


for i in range(8):
	s = input()
	s1 = set([s[j] for j in range(8) if j % 2 == 0])
	s2 = set([s[j] for j in range(8) if j % 2 == 1])
	if len(s1) != 1 or len(s2) != 1 or s1 == s2:
		print('NO')
		break
else:
	print('YES')


case = True
for i in range(8):
	s = input()
	if s != 'WBWBWBWB' and s != 'BWBWBWBW':
		case = False
if case:
	print('YES')
else:
	print('NO')


for i in range(8):
	s = list(input())
	for i in range(7):
		if s[i] == s[i + 1]:
			print('NO')
			exit()
print('YES')


possible = True
for i in range(8):
	line = input()
	if line[0] == line[1] == line[-1] or line[-1] == line[-2] == line[0]:
		possible = False
		continue
	if not possible:
		continue
	cf = line.split('W')
	cg = line.split('B')
	empty = one = True
	while True:
		try:
			cf.remove('')
		except Exception:
			empty = False
		try:
			cf.remove('B')
		except Exception:
			one = False
		if not empty and (not one):
			break
	empty = one = True
	while True:
		try:
			cg.remove('W')
		except Exception:
			empty = False
		try:
			cg.remove('')
		except Exception:
			one = False
		if not empty and (not one):
			break
	if len(cf) >= 2:
		possible = False
	if len(cg) >= 2:
		possible = False
	if len(cf) + len(cg) >= 2:
		possible = False
	if len(cf) == 1:
		if len(cf[0]) > 2:
			possible = False
	if len(cg) == 1:
		if len(cg[0]) > 2:
			possible = False
	if i == 0:
		pf = cf[:]
		pg = cg[:]
		continue
	if len(cf) == 1:
		if len(pf) == 1:
			possible = False
	if len(cg) == 1:
		if len(pg) == 1:
			possible = False
	pf = cf[:]
	pg = cg[:]
if possible:
	print('YES')
else:
	print('NO')


c = 1
for i in range(8):
	s = input()
	if s != 'WBWBWBWB' and s != 'BWBWBWBW':
		c = 0
if c:
	print('YES')
else:
	print('NO')


from collections import *
import itertools
board = [list(input().strip()) for _ in range(8)]
for i in range(8):
	cnts = Counter(board[i])
	if cnts['B'] != cnts['W']:
		print('NO')
		exit()
	for (k, grp) in itertools.groupby(board[i]):
		lst = list(grp)
		if len(lst) != 1:
			print('NO')
			exit()
print('YES')


import sys
import math
for i in range(8):
	st = sys.stdin.readline()
	for j in range(7):
		if st[j] == st[j + 1]:
			print('NO')
			return
print('YES')


from sys import stdin, stdout
if not __debug__:
	stdin = open('input.txt', 'r')
tcs = int(stdin.readline()) if not __debug__ else 1
t = 1
while t <= tcs:
	res = True
	for _ in range(8):
		row = str(stdin.readline())
		for c in range(8):
			if row[c] == row[c - 1]:
				res = False
				break
	print('YES' if res else 'NO')
	t += 1


__copyright__ = ''
__author__ = 'Son-Huy TRAN'
__email__ = 'sonhuytran@gmail.com'
__doc__ = ''
__version__ = '1.0'

def is_proper_chessboard(chessboard: list) -> bool:
	propers = ['WBWBWBWB', 'BWBWBWBW']
	for row in chessboard:
		if row != propers[0] and row != propers[1]:
			return False
	return True

def main() -> int:
	chessboard = []
	for _ in range(8):
		chessboard.append(input())
	print('YES' if is_proper_chessboard(chessboard) else 'NO')
	return 0
exit(main())


l = [input() for i in range(8)]
b = True
i = -1
for i in l:
	for j in range(7):
		if i[j] == i[j + 1]:
			b = False
			break
	if not b:
		break
if b:
	print('YES')
else:
	print('NO')


import math

def main_function():
	board = [input() for i in range(8)]
	board_is_good = True
	for i in board:
		for j in range(1, len(i)):
			if i[j] == i[j - 1]:
				board_is_good = False
				break
	if board_is_good:
		print('YES')
	else:
		print('NO')
main_function()


chess = []
for i in range(8):
	chess.append(input())
ans = 'YES'
for x in chess:
	if x != 'WBWBWBWB' and x != 'BWBWBWBW':
		ans = 'NO'
		break
print(ans)


flag = True
for i in range(8):
	row = input()
	x = row[0]
	y = row[1]
	if x == y:
		flag &= False
	else:
		for j in range(2, 8):
			if j % 2 == 0:
				if row[j] != x:
					flag &= False
					break
			elif row[j] != y:
				flag &= False
				break
if flag:
	print('YES')
else:
	print('NO')


x = 'WBWBWBWB'
y = 'BWBWBWBW'
s = [input() for _ in ' ' * 8]
for i in s:
	if i == x or i == y:
		continue
	else:
		print('NO')
		exit(0)
print('YES')


for i in range(8):
	s = input()
	if s.count('BW') == 4 or s.count('WB') == 4:
		pass
	else:
		print('NO')
		exit()
print('YES')


import re
for i in range(8):
	s = input()
	if re.findall('(WW)|(BB)', s):
		print('NO')
		exit(0)
print('YES')


def main():
	n = 8
	while n:
		r = input()
		for i in range(7):
			if r[i] == r[i + 1]:
				print('NO')
				return 0
		n -= 1
	print('YES')
	return 0
main()


def main():
	board = []
	checkNo = 0
	for i in range(8):
		row = input()
		row = list(row)
		board.append(row)
	for i in range(8):
		for j in range(7):
			if board[i][0] == board[i][7]:
				print('NO')
				checkNo = 1
				break
			elif board[i][j] == board[i][j + 1]:
				print('NO')
				checkNo = 1
				break
		if checkNo == 1:
			break
	if checkNo == 0:
		print('YES')
main()


for i in range(8):
	l = input()
	if l != 'WBWBWBWB' and l != 'BWBWBWBW':
		print('NO')
		exit()
print('YES')


for _ in range(8):
	row = input()
	if 'BB' in row or 'WW' in row:
		print('NO')
		break
else:
	print('YES')


chess = [input() for i in range(8)]
solve = 'YES'
for c in chess:
	if 'WW' in c or 'BB' in c:
		solve = 'NO'
		break
	else:
		continue
print(solve)


a = []
for i in range(8):
	a.append(input())
bhul = False
for x in a:
	for i in range(7):
		if x[i] == x[i + 1]:
			print('NO')
			bhul = True
			break
	if bhul:
		break
if bhul == False:
	print('YES')


def checkvalid(u, d):
	for i in range(8):
		cnt = 0
		for j in range(8):
			if u[j] != d[i + j]:
				cnt += 1
			if j >= 1 and (u[j] == u[j - 1] or d[i + j] == d[i + j - 1]):
				cnt = 0
				break
		if cnt == 8:
			return True
	return False
u = input()
d = input()
cnt = 2
isvalid = True
isvalid = checkvalid(u, d + d)
while cnt <= 7:
	cnt += 1
	u = d
	d = input()
	isvalid = isvalid and checkvalid(u, d + d)
if isvalid:
	print('YES')
else:
	print('NO')


l = []
flag = 0
for i in range(8):
	l.append(input())
	for j in range(1, 8):
		if l[i][j] == l[i][j - 1]:
			flag = 1
			break
if flag == 1:
	print('NO')
else:
	print('YES')


arr = [list(input()) for _ in range(8)]
cw = 0
cb = 0
flag = True
for i in range(0, 8):
	for j in range(1, 8):
		if arr[i][j] == arr[i][j - 1]:
			flag = False
if flag == True:
	print('YES')
elif flag == False:
	print('NO')


def main():
	for i in range(8):
		row = input()
		prev = row[0]
		for j in range(1, 8, 1):
			if prev == row[j]:
				return 'NO'
			else:
				prev = row[j]
	return 'YES'
print(main())


ans = 'YES'
for i in range(8):
	t = input()
	if t[0] == 'B':
		if t.count('BW') != 4:
			ans = 'NO'
			break
	elif t.count('WB') != 4:
		ans = 'NO'
		break
print(ans)


solution = 'YES'
for _ in range(8):
	row = input()
	for column in range(7):
		if row[column] == row[column + 1]:
			solution = 'NO'
			break
	if solution == 'NO':
		break
print(solution)


final_ = 'Yes'
for i in range(8):
	current_row = list(input())
	current_row.append(current_row[0])
	for j in range(8):
		if current_row[j] == current_row[j + 1]:
			final_ = 'NO'
print(final_)


ans = True
for i in range(8):
	s = input()
	for i in range(7):
		if s[i] == s[i + 1]:
			ans = False
if ans:
	print('YES')
else:
	print('NO')


arr = []
for i in range(8):
	arr.append(input())
for i in range(8):
	w = arr[i].count('W')
	b = 8 - w
	if w != 4:
		print('NO')
		exit()
	for j in range(8):
		if arr[i][j] == arr[i][(j + 1) % 8]:
			print('NO')
			exit()
print('YES')


def d():
	try:
		while True:
			a = input().strip()
			if a != 'WBWBWBWB' and a != 'BWBWBWBW':
				return 'NO'
	except:
		return 'YES'
print(d())


int1 = 'WBWBWBWB'
int2 = 'BWBWBWBW'
res = 0
for i in range(8):
	line = str(input())
	for j in range(len(line)):
		if line == int1 or line == int2:
			res += 1
if res / 8 == 8:
	print('YES')
else:
	print('NO')


ans = 'YES'
for _ in range(8):
	s = input()
	if s not in ['WB' * 4, 'BW' * 4]:
		ans = 'NO'
print(ans)


an = 1
for i in range(8):
	a = list(input())
	if a.count('W') != 4:
		an = -1
	else:
		for j in range(1, 8):
			if a[j] == a[j - 1]:
				an = -1
if an == 1:
	print('YES')
else:
	print('NO')


import re
for _ in range(8):
	if re.search('WW|BB', input()) is not None:
		print('NO')
		exit()
print('YES')


f = 0
for i in range(8):
	l = list(input())
	for j in range(7):
		if l[j] == l[j + 1]:
			f = 1
			break
	if l[0] == l[-1]:
		f = 1
if f == 0:
	print('YES')
else:
	print('NO')


t = 0
ok = 0
while t < 8:
	last = '#'
	s = input()
	for i in s:
		if last == '#':
			last = i
		elif last == i:
			ok = 1
		last = i
	t += 1
if ok == 0:
	print('YES')
else:
	print('NO')


t = []
u = 0
for i in range(8):
	a = list(input())
	if a.count('B') == a.count('W'):
		for k in range(7):
			if a[k] != a[k + 1]:
				pass
			else:
				u += 1
	else:
		u += 1
	t.append(a)
if u > 0:
	print('NO')
else:
	print('YES')


a = ['WBWBWBWB', 'BWBWBWBW']
ans = True
for x in range(8):
	x = input().strip()
	if x not in a:
		ans = False
print('YES' if ans else 'NO')


l = []
for i in range(8):
	s = input()
	l.append(s)
for i in range(8):
	flag = 0
	for j in range(7):
		if l[i][j] == l[i][j + 1]:
			print('NO')
			exit(0)
print('YES')


for i in range(8):
	s = input()
	if s != 'BW' * 4 and s != 'WB' * 4:
		print('NO')
		break
	if i == 7:
		print('YES')


for i in range(8):
	daf = input()
	if 'WW' in daf or 'BB' in daf:
		print('NO')
		break
else:
	print('YES')


chess = ['WBWBWBWB', 'BWBWBWBW']
rows = [input() for x in range(8)]
for x in range(8):
	r = rows[x]
	for y in range(8):
		r = r[-1] + r[:-1]
		if r == chess[x % 2]:
			break
	else:
		print('NO')
		break
else:
	print('YES')


from sys import exit
for _ in range(8):
	curr_line = input()
	if curr_line != 'WBWBWBWB' and curr_line != 'BWBWBWBW':
		print('NO')
		exit(0)
print('YES')


s = []
for i in range(8):
	s.append(input())

def check(i, index):
	if index % 2:
		pat = 'BWBWBWBW'
		l = [i[-j:] + i[:8 - j] for j in range(1, 9)]
		if pat in l:
			return True
		else:
			return False
	else:
		pat = 'WBWBWBWB'
		l = [i[-j:] + i[:8 - j] for j in range(1, 9)]
		if pat in l:
			return True
		else:
			return False
stat = True
for i in range(8):
	if check(s[i], i) == False:
		stat = False
		break
print(['YES', 'NO'][not stat])


s = ''
for i in range(8):
	s = s + input() + ','
print('YNEOS '[s.count('WBWBWBWB') + s.count('BWBWBWBW') != 8::2])


board = []
for cont in range(0, 8):
	board.append(input())
l = True
for row in board:
	for cont in range(0, 7):
		if row[cont] == row[cont + 1]:
			l = False
			break
	if l is False:
		break
if l:
	print('YES')
else:
	print('NO')


from sys import stdin, stdout

def solve(data):

	def does_alternate(row):
		prev = row[0]
		for x in row[1:]:
			if x == prev:
				return False
			else:
				prev = x
		return True
	rest_lines = list(map(str.strip, data[:]))
	alternating_rows = list(filter(does_alternate, rest_lines))
	answer = 'YES' if len(alternating_rows) == 8 else 'NO'
	return answer
data = stdin.readlines()
answer = solve(data)
if type(answer) in [list]:
	stdout.writelines(map(str, answer))
else:
	stdout.write(str(answer))


c = 0
for i in range(8):
	s = input()
	for j in range(len(s) - 1):
		if s[j] == s[j + 1]:
			c += 1
			break
if c == 0:
	print('YES')
else:
	print('NO')


valid = True
for i in range(8):
	line = input()
	if line != 'WBWBWBWB' and line != 'BWBWBWBW':
		valid = False
if valid:
	print('YES')
else:
	print('NO')


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
from collections import deque, Counter, OrderedDict, defaultdict
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
(mod, MOD) = (1000000007, 998244353)
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p1
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	l = []
	for i in range(8):
		l.append(list(si()))
	for i in range(8):
		for j in range(1, 8):
			if l[i][j] == l[i][j - 1]:
				print('NO')
				exit()
	print('YES')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def main():
	board = list()
	for _ in range(8):
		board.append(list(input()))
	for i in range(8):
		for j in range(8):
			j1 = (j + 1) % 8
			(b, a) = (board[i][j], board[i][j1])
			if b == 'W' and a == 'W' or (b == 'B' and a == 'B'):
				print('NO')
				return
	print('YES')
main()


chess = []
for i in range(8):
	chess.append(input())
flag = True
for i in range(8):
	for j in range(7):
		if chess[i][j] == chess[i][j + 1]:
			flag = False
			break
	if not flag:
		break
if flag:
	print('YES')
else:
	print('NO')


valid = True
for i in range(8):
	S = input()
	if S not in ('BW' * 4, 'WB' * 4):
		valid = False
print('YES' if valid else 'NO')


def check(s):
	for j in range(1, 8):
		if s[j] == s[j - 1]:
			return 'NO'
			break
	return 'YES'
for i in range(8):
	s = check(input())
	if s == 'NO':
		print('NO')
		break
else:
	print('YES')
for i in range(i + 1, 8):
	input()


t = True
for i in range(8):
	a = input()
	if a != 'WBWBWBWB' and a != 'BWBWBWBW':
		t = False
print('YES' if t else 'NO')


import bisect
import decimal
from decimal import Decimal
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
decimal.getcontext().prec = 46

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def DFS(n, s, adj):
	visited = [False for i in range(n + 1)]
	stack = []
	stack.append(s)
	while len(stack):
		s = stack[-1]
		stack.pop()
		if not visited[s]:
			visited[s] = True
		for node in adj[s]:
			if not visited[node]:
				stack.append(node)

def solve():
	for _ in range(8):
		s = input()
		s1 = ''.join(s.split('BB'))
		s2 = ''.join(s.split('WW'))
		if len(s1) < 8 or len(s2) < 8:
			print('NO')
			return
	print('YES')
t = 1
for _ in range(t):
	solve()


flag = True
for i in range(8):
	s = input()
	if s.count('WB') != 4 and s.count('BW') != 4:
		print('NO')
		flag = False
		break
if flag:
	print('YES')


try:
	c = 0
	for i in range(0, 8):
		s = str(input())
		s1 = 'BWBWBWBW'
		s2 = 'WBWBWBWB'
		if s == s1 or s == s2:
			continue
		else:
			c = 1
			break
	if c == 0:
		print('YES')
	else:
		print('NO')
except Exception:
	pass


flag = 0
for i in range(8):
	s = input()
	if flag == 0:
		if s == 'BWBWBWBW' or s == 'WBWBWBWB':
			flag = 0
		else:
			flag = 1
if flag == 0:
	print('YES')
else:
	print('NO')


flag = True
for _ in range(8):
	s = input()
	if s.count('W') == 4 and s.count('B') == 4:
		c = s[0]
		for i in s[1:]:
			if i == c:
				flag = False
			else:
				c = i
	else:
		flag = False
if flag:
	print('YES')
else:
	print('NO')


def go():
	for i in range(8):
		s = input()
		prv = 0
		for j in s:
			if j == prv:
				return False
			prv = j
	return True
print('YES' if go() else 'NO')


flag = 0
for i in range(8):
	prev = 'X'
	arr = list(input())
	for ch in arr:
		if ch == prev:
			flag = 1
			break
		prev = ch
	if flag == 1:
		break
if flag == 0:
	print('YES')
else:
	print('NO')


checker = 0
for i in range(0, 8):
	s = input()
	if s[0] != s[1]:
		for i in range(2, 8):
			if s[i] != s[i - 2]:
				checker = 1
	else:
		checker = 1
if checker == 1:
	print('NO')
else:
	print('YES')


counter = 1
for i in range(8):
	a = input()
	if a.count('WB') == 4 or a.count('BW') == 4:
		continue
	else:
		counter = 0
		print('NO')
		break
if counter:
	print('YES')


l1 = []
for j in range(8):
	s = list(input())
	c = 0
	for i in range(7):
		if s[i] != s[i + 1]:
			c += 1
	if c == 7:
		l1.append(c)
if len(l1) == 8:
	print('YES')
else:
	print('NO')


ans = 1
for i in range(8):
	a = input()
	if a != 'WBWBWBWB' and a != 'BWBWBWBW':
		ans = 0
if ans:
	print('YES')
else:
	print('NO')


l = []
flag = 1
for i in range(8):
	l.append(input())
	if flag:
		if l[i].count('B') > 4 or l[i].count('W') > 4:
			flag = 0
		for j in range(7):
			if l[i][j] == l[i][j + 1]:
				flag = 0
				break
if not flag:
	print('NO')
	exit()
print('YES')


yes = True
for i in range(8):
	s = input()
	if yes:
		for j in range(7):
			if s[j] == s[j + 1]:
				yes = False
				break
print('YES' if yes else 'NO')


flag = 0
for _ in range(8):
	s = input()
	for i in range(0, 7):
		if s[i] == s[i + 1]:
			flag = 1
			break
if flag:
	print('NO')
else:
	print('YES')


v = [[0 for j in range(8)] for y in range(8)]
for i in range(8):
	s = input()
	for j in range(8):
		v[i][j] = s[j]
good = True
for i in range(8):
	for j in range(8):
		if j + 1 < 8 and v[i][j] == v[i][j + 1]:
			good = False
if good:
	print('YES')
else:
	print('NO')


from sys import stdin

def fun(row):
	col1 = row[0]
	col2 = row[1]
	if col1 != col2:
		for i in range(8):
			if i % 2 == 0:
				if row[i] != col1:
					return False
			elif row[i] != col2:
				return False
	else:
		return False
	return True
list = []
for i in range(8):
	list.append(stdin.readline())
valid = 1
for row in list:
	if not fun(row):
		valid = 0
		break
if valid == 1:
	print('YES')
else:
	print('NO')


flag = True
for i in range(8):
	k = input()
	if k != 'BWBWBWBW' and k != 'WBWBWBWB':
		flag = False
if flag:
	print('YES')
else:
	print('NO')


seq = 'WBWBWBWBWBWBWBWB'
flag = 0
for _ in range(8):
	s = input()
	if s not in seq:
		flag = 1
		break
if flag:
	print('NO')
else:
	print('YES')


arr = [list(input()) for _ in range(8)]
cw = 0
cb = 0
flag = False
for i in range(8):
	for j in range(8):
		if arr[i][j] == 'W' and j == 7:
			cw += 1
		elif arr[i][j] == 'B' and j == 7:
			cb += 1
		elif arr[i][j] == 'B' and arr[i][j + 1] == 'B' or (arr[i][j] == 'W' and arr[i][j + 1] == 'W'):
			cb += 2
		elif arr[i][j] == 'W' and arr[i][j + 1] == 'B' and (j != 7):
			cw += 1
		elif arr[i][j] == 'B' and arr[i][j + 1] == 'W' and (j != 7):
			cb += 1
	if cw == cb:
		cw = cb = 0
		flag = True
		continue
	else:
		flag = False
		print('NO')
		break
if flag == True:
	print('YES')


for i in range(8):
	l = input()
	if 'BB' in l or 'WW' in l or l[0] == l[-1]:
		print('NO')
		break
else:
	print('YES')


test = False
for i in range(8):
	ch = input()
	if 'WW' in ch or 'BB' in ch:
		test = True
if test:
	print('NO')
else:
	print('YES')


map = []
normal = ['WBWBWBWB', 'BWBWBWBW']
for i in range(8):
	str = input()
	if str not in normal:
		print('NO')
		exit()
print('YES')


def okay(s):
	if s in ('WBWBWBWB', 'BWBWBWBW'):
		return True
	return False
rows = []
for _ in range(8):
	rows.append(input())
for i in range(8):
	if not okay(rows[i]):
		print('NO')
		exit()
print('YES')


import sys
f = sys.stdin

def solve():
	nonlocal f
	a = f.read().strip().split('\n')
	for l in range(8):
		count = 0
		for i in range(7):
			if a[l][i] == a[l][i + 1]:
				count += 1
				if count >= 2:
					print('NO')
					return
	for l in range(1, 7):
		for i in range(1, 7):
			if a[l][i] == a[l + 1][i] == a[l][i + 1] == a[l + 1][i + 1]:
				print('NO')
				return
	else:
		print('YES')
		return
solve()


l = []
fg = 0
for i in range(0, 8):
	s = input()
	for j in range(0, 7):
		if s[j] == s[j + 1]:
			fg = 1
	if s[0] == s[7]:
		fg = 1
if fg == 1:
	print('NO')
else:
	print('YES')


import sys
a = [str(input()) for x in range(8)]
for x in a:
	if x == 'WBWBWBWB':
		continue
	elif x == 'BWBWBWBW':
		continue
	else:
		print('NO')
		sys.exit()
print('YES')


def proper(line):
	current = line[0]
	for j in range(1, len(line)):
		if line[j] == current:
			return False
		else:
			current = line[j]
	return True
answer = 'YES'
for i in range(8):
	if not proper(input()):
		answer = 'NO'
print(answer)


chess = [] * 8
for i in range(8):
	a = input()
	chess.append(a)
R = chess.count('WBWBWBWB')
D = chess.count('BWBWBWBW')
counter = R + D
if counter is 8:
	print('YES')
else:
	print('NO')


k = 0
for i in range(8):
	n = input()
	if 'WW' in n or 'BB' in n:
		k = 1
if k == 1:
	print('NO')
else:
	print('YES')


ans = 'YES'
for i in range(8):
	s = input()
	if s != (s[0] + s[1]) * 4 or s[0] == s[1]:
		ans = 'NO'
print(ans)


flag = True
for i in range(8):
	ls = input()
	temp = ls[0]
	w = sum([1 for s in range(2, len(ls), 2) if ls[s] == temp])
	w_sum = sum([1 for s in ls if s == 'W'])
	if w != 3 or w_sum != 4:
		flag = False
		break
print('YES' if flag else 'NO')


t1 = 'WBWBWBWB'
t2 = 'BWBWBWBW'
flag1 = 0
for i in range(0, 8):
	s = input()
	if s == t1 or s == t2:
		continue
	else:
		flag1 = 1
		break
if flag1 == 0:
	print('YES')
else:
	print('NO')


import sys
import os
if os.environ.get('GHOST') == 'TRUE':
	sys.stdin = open('name.in')
	sys.stdout = open('name.out', 'w')
ok = True
for t in range(8):
	row = input()
	for i in range(8):
		if i > 0 and row[i] == row[i - 1]:
			ok = False
if ok:
	print('YES')
else:
	print('NO')


a = []
for i in range(8):
	a.append(list(input()))
k = 0
for i in range(8):
	for j in range(7):
		if a[i][j] == a[i][j + 1]:
			k += 1
if k > 0:
	print('NO')
else:
	print('YES')


w = 0
b = 0
ans = 1
for i in range(8):
	ww = 0
	bb = 0
	str = input()
	w += str.count('W')
	b += str.count('B')
	ww += str.count('WW')
	bb += str.count('BB')
	if ww >= 1 and bb >= 1:
		ans = 0
	elif ww >= 2:
		ans = 0
	elif bb >= 2:
		ans = 0
if b == 32 and w == 32 and (ans != 0):
	print('YES')
else:
	print('NO')


correct_lines = {0: 'WBWBWBWB', 1: 'BWBWBWBW', 2: 'WBWBWBWB', 3: 'BWBWBWBW', 4: 'WBWBWBWB', 5: 'BWBWBWBW', 6: 'WBWBWBWB', 7: 'BWBWBWBW'}

def check_line(idx, line):
	for j in range(len(line)):
		cyclic = line[j:] + line[:j]
		if cyclic == correct_lines[idx]:
			return True
	return False
lines = []
for _ in range(8):
	lines.append(input())
checked_lines = [check_line(idx, line) for (idx, line) in enumerate(lines)]
if False in checked_lines:
	print('NO')
else:
	print('YES')


res = True
for _ in range(0, 8):
	r = str(input())
	if r.count('BB') is not 0 or r.count('WW') is not 0:
		res = False
if res is True:
	print('YES')
else:
	print('NO')


g = []
for i in range(8):
	g.append([i for i in input()])
ok = True
for i in g:
	for j in range(1, len(i)):
		if i[j] == i[j - 1]:
			ok = False
			break
print('YES' if ok else 'NO')


l = []
for i in range(8):
	l.append(input())
(flag1, flag2) = (True, True)
for i in l:
	x = i.count('B')
	y = 8 - x
	if x == 4 and y == 4:
		continue
	flag1 = False
	break
if flag1 == False:
	print('NO')
	exit()
else:
	for i in l:
		x = i * 3
		(a, b) = (x.find('BB'), x.find('WW'))
		if a >= 0 or b >= 0:
			flag2 = False
			break
	if flag2 == False:
		print('NO')
	else:
		print('YES')


x = []
for i in range(8):
	x.append(list(input()))
k = True
for i in range(8):
	for j in range(7):
		if x[i][j] == x[i][j + 1]:
			k = False
			break
if k:
	print('YES')
else:
	print('NO')


c = True
for _ in range(8):
	s = input()
	if not (s == 'WBWBWBWB' or s == 'BWBWBWBW'):
		c = False
if c:
	print('YES')
else:
	print('NO')


c = 0
t = ['WBWBWBWB', 'BWBWBWBW']
for i in range(8):
	x = input()
	if x in t:
		c += 1
if c == 8:
	print('YES')
else:
	print('NO')


state = -1
res = True
val = lambda c, m: not (c == 'W') ^ (m % 2 == 1)
for i in range(8):
	s = input()
	if 'WWW' in s or 'BBB' in s or ('WW' in s and 'BB' in s) or (s.count('WW') > 1) or (s.count('BB') > 1):
		res = False
	c = ''
	if 'WW' in s:
		c = 'W'
	if 'BB' in s:
		c = 'B'
	if c == '':
		continue
	if state == -1:
		state = val(c, i)
	elif state != val(c, i):
		res = False
print('YES' if res else 'NO')


ans = True
for i in range(8):
	m = input()
	for l in range(7):
		if m[l] == m[l + 1]:
			ans = False
if ans == True:
	print('YES')
else:
	print('NO')


arr = []
for i in range(8):
	arr.append(input())
for i in range(8):
	if arr[i][0] == arr[i][-1]:
		print('NO')
		exit()
	for j in range(7):
		if arr[i][j] == arr[i][j + 1]:
			print('NO')
			exit()
print('YES')


r = 0
a = 'WBWBWBWB'
b = 'BWBWBWBW'
for i in range(8):
	x = input()
	if x == a or x == b:
		r += 1
if r == 8:
	print('YES')
else:
	print('NO')


def str_inp(n):
	return [input() for x in range(n)]

def check(x):
	if x != 'WB' * 4 and x != 'BW' * 4:
		exit(print('NO'))
	return 'YES'
s = str_inp(8)
print(list(map(check, s))[0])


for i in range(8):
	s = input()
	if s.find('BB') != -1 or s.find('WW') != -1:
		print('NO')
		exit()
print('YES')


import sys
flag = True
for i in range(1, 9):
	string = input()
	if flag:
		for j in range(0, 7):
			if string[j] == string[j + 1]:
				flag = False
				break
if flag:
	print('Yes')
else:
	print('No')


def foo():
	table = []
	for i in range(8):
		table.append(input())
	w = 'W' * 4
	b = 'B' * 4
	for s in table:
		a1 = s[0:len(s):2]
		a2 = s[1:len(s):2]
		if not (a1 == w and a2 == b or (a1 == b and a2 == w)):
			print('NO')
			return
	print('YES')
foo()


for i in range(8):
	s = input()
	if s == 'BWBWBWBW' or s == 'WBWBWBWB':
		continue
	else:
		print('NO')
		break
else:
	print('YES')
for i in range(i + 1, 8):
	input()


f = 0
for i in range(8):
	a = input()
	p = a[0]
	for j in a[1:]:
		if p == j:
			f = 1
			break
		p = j
	if a[0] == a[-1]:
		f = 1
	if f == 1:
		break
if f == 0:
	print('YES')
else:
	print('NO')


flag = True
for i in range(0, 8):
	s = str(input())
	if s == 'WBWBWBWB' or s == 'BWBWBWBW':
		flag = True
	else:
		flag = False
		break
if flag:
	print('YES')
else:
	print('NO')


proper = True
for i in range(8):
	raw = input()
	if raw != 'WBWBWBWB' and raw != 'BWBWBWBW':
		proper = False
if proper:
	print('YES')
else:
	print('NO')


e = True
for i in range(8):
	a = input()
	if (a != 'BW' * 4) & (a != 'WB' * 4):
		e = False
		print('NO')
		break
if e:
	print('YES')


exec("print('YNEOS'[any('WW'in a or'BB' in a for a in[" + 8 * 'input(),' + '])::2])')


def chess(li):
	for i in range(8):
		for j in range(8):
			if li[i][0] == li[i][7]:
				return False
			if j + 1 < len(li) and li[i][j] == li[i][j + 1]:
				return False
	return True
li = []
for i in range(8):
	a = input()
	li.append(list(a))
if chess(li):
	print('YES')
else:
	print('NO')


def solve():
	for i in range(8):
		row = list(input())
		prev = row.pop(0)
		for j in row:
			if j == prev:
				print('NO')
				return
			prev = j
	print('YES')
solve()


def validate(value_row: str):
	if 'B' not in value_row or 'W' not in value_row:
		return False
	one = 0
	two = 0
	for (i, cell) in enumerate(value_row):
		if cell == 'W':
			one += 1
			if i != 0 and value_row[i - 1] == 'W':
				return False
		else:
			two += 1
			if i != 0 and value_row[i - 1] == 'B':
				return False
	if one != two:
		return False
	return value_row
board = []
for i in range(8):
	row = input()
	if False in board:
		pass
	else:
		board.append(validate(row))
if False in board:
	print('NO')
else:
	print('YES')


for i in range(8):
	X = input()
	if 'WW' in X or 'BB' in X:
		print('NO')
		exit()
print('YES')


l = []
for i in range(8):
	s = input()
	l.append(s)
c = 0
for i in range(8):
	for j in range(len(l[i]) - 1):
		if ord(l[i][j]) - ord(l[i][j + 1]) != 0:
			continue
		else:
			c = 1
			break
if c == 1:
	print('NO')
else:
	print('YES')


impflag = 0
for i in range(8):
	a = input()
	if a[0] == 'W':
		last = 'W'
	else:
		last = 'B'
	for j in range(1, 8):
		if a[j] == last:
			impflag = 1
			break
		else:
			last = a[j]
	if impflag == 1:
		break
if impflag == 0:
	print('YES')
else:
	print('NO')


c = 0
for _ in range(8):
	s = input().strip()
	c += s.count('BB')
	c += s.count('WW')
print('NO') if c else print('YES')


lis = []
for i in range(8):
	lis.append(input())
lis1 = ['WBWBWBWB', 'BWBWBWBW']
check = 1
for i in range(8):
	if lis[i] not in lis1:
		check = 0
if check == 0:
	print('NO')
else:
	print('YES')


board = []
(b, w) = ('B', 'W')
check = False
for i in range(8):
	board.append(str(input()))
for i in board:
	a = w + b
	if 'BB' in i or 'WW' in i:
		print('NO')
		check = True
		break
	if i != a * 4:
		i = i[-1] + i[:7]
		if i != a * 4:
			print('NO')
			check = True
			break
	(b, w) = (w, b)
if check == False:
	print('YES')


M = []
f = True
for i in range(8):
	M.append(input())
	for i in range(1, 8):
		if M[-1][i] == M[-1][i - 1]:
			f = False
if f:
	print('YES')
else:
	print('NO')