887_C. Solution for Cube
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.

It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation of one face of the cube in any direction.

To check her answers she wants to use a program which will for some state of cube tell if it's possible to solve it using one rotation, described above.

Cube is called solved if for each face of cube all squares on it has the same color.

https://en.wikipedia.org/wiki/Rubik's_Cube

Input

In first line given a sequence of 24 integers ai (1 ≤ ai ≤ 6), where ai denotes color of i-th square. There are exactly 4 occurrences of all colors in this sequence.

Output

Print «YES» (without quotes) if it's possible to solve cube using one rotation and «NO» (without quotes) otherwise.

Examples

Input

2 5 4 6 1 3 6 2 5 5 1 2 3 5 3 1 1 2 4 6 6 4 3 4


Output

NO

Input

5 3 5 3 2 5 2 5 6 2 6 2 4 4 4 4 1 1 1 1 6 3 6 3


Output

YES

Note

In first test case cube looks like this:

<image>

In second test case cube looks like this: 

<image>

It's possible to solve cube by rotating face with squares with numbers 13, 14, 15, 16.
```python
# Main maut ko takiya, aur kafan ko chaadar banakar audhta hoon!

def R(b):
	c=[]
	for i in b:
		c.append(i)
	
	c[1]=b[5]
	c[3]=b[7]
	c[5]=b[9]
	c[7]=b[11]
	c[9]=b[22]
	c[11]=b[20]
	c[22]=b[1]
	c[20]=b[3]
	
	d=[]
	for i in range(23):
		if(c[i]!=c[i+1]):
			d.append(c[i])
	d.append(c[-1])
	if(len(d)==6):
		return True
	else:
		return False
		
def Rp(b):
	c=[]
	for i in b:
		c.append(i)
	
	c[5]=b[1]
	c[7]=b[3]
	c[9]=b[5]
	c[11]=b[7]
	c[22]=b[9]
	c[20]=b[11]
	c[1]=b[22]
	c[3]=b[20]
	
	d=[]
	for i in range(23):
		if(c[i]!=c[i+1]):
			d.append(c[i])
	d.append(c[-1])
	if(len(d)==6):
		return True
	else:
		return False

def U(b):
	c=[]
	for i in b:
		c.append(i)
	
	c[4]=b[16]
	c[5]=b[17]
	c[16]=b[20]
	c[17]=b[21]
	c[20]=b[12]
	c[21]=b[13]
	c[12]=b[4]
	c[13]=b[5]
	
	d=[]
	for i in range(23):
		if(c[i]!=c[i+1]):
			d.append(c[i])
	d.append(c[-1])
	if(len(d)==6):
		return True
	else:
		return False

def Up(b):
	c=[]
	for i in b:
		c.append(i)
	
	c[16]=b[4]
	c[17]=b[5]
	c[20]=b[16]
	c[21]=b[17]
	c[12]=b[20]
	c[13]=b[21]
	c[4]=b[12]
	c[5]=b[13]
	
	d=[]
	for i in range(23):
		if(c[i]!=c[i+1]):
			d.append(c[i])
	d.append(c[-1])
	if(len(d)==6):
		return True
	else:
		return False
	
def F(b):
	c=[]
	for i in b:
		c.append(i)
	
	c[13]=b[3]
	c[15]=b[2]
	c[8]=b[13]
	c[9]=b[15]
	c[18]=b[8]
	c[16]=b[9]
	c[3]=b[18]
	c[2]=b[16]
	
	d=[]
	for i in range(23):
		if(c[i]!=c[i+1]):
			d.append(c[i])
	d.append(c[-1])
	if(len(d)==6):
		return True
	else:
		return False

def Fp(b):
	c=[]
	for i in b:
		c.append(i)
	
	c[3]=b[13]
	c[2]=b[15]
	c[13]=b[8]
	c[15]=b[9]
	c[8]=b[18]
	c[9]=b[16]
	c[18]=b[3]
	c[16]=b[2]
	
	d=[]
	for i in range(23):
		if(c[i]!=c[i+1]):
			d.append(c[i])
	d.append(c[-1])
	if(len(d)==6):
		return True
	else:
		return False

	
a=list(map(int,input().split()))

if(R(a) or Rp(a) or Up(a) or U(a) or F(a) or Fp(a)):
	print("yes")
else:
	print("no")



```