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.

<a>https://en.wikipedia.org/wiki/Rubik's_Cube</a>
In first line given a sequence of 24 integers *a*<sub class="lower-index">*i*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 6), where *a*<sub class="lower-index">*i*</sub> denotes color of *i*-th square. There are exactly 4 occurrences of all colors in this sequence.
In first test case cube looks like this:

In second test case cube looks like this: 

It's possible to solve cube by rotating face with squares with numbers 13, 14, 15, 16.
2 5 4 6 1 3 6 2 5 5 1 2 3 5 3 1 1 2 4 6 6 4 3 4
NO
5 3 5 3 2 5 2 5 6 2 6 2 4 4 4 4 1 1 1 1 6 3 6 3
YES
2 6 3 3 5 5 2 6 1 1 6 4 4 4 2 4 6 5 3 1 2 5 3 1
NO
3 4 2 3 5 5 6 6 4 5 4 6 5 1 1 1 6 2 1 3 3 2 4 2
NO
5 5 2 5 3 3 2 6 6 4 2 4 6 1 4 3 1 6 2 1 3 4 5 1
NO
6 6 1 2 6 1 1 3 5 4 3 4 3 5 5 2 4 4 6 2 1 5 3 2
NO
2 2 1 1 5 5 5 5 3 3 4 4 1 4 1 4 2 3 2 3 6 6 6 6
YES
1 1 1 1 5 5 3 3 4 4 4 4 3 3 2 2 6 6 5 5 2 2 6 6
YES
1 1 1 1 3 3 3 3 5 5 5 5 2 2 2 2 4 4 4 4 6 6 6 6
NO
5 4 5 4 4 6 4 6 6 3 6 3 1 1 1 1 2 2 2 2 5 3 5 3
YES
3 3 5 5 2 2 2 2 6 6 4 4 6 3 6 3 4 5 4 5 1 1 1 1
YES
6 6 6 6 2 2 5 5 1 1 1 1 4 4 2 2 5 5 3 3 3 3 4 4
YES
4 6 4 6 6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 2 3 1 1 5 2 2 5 6 6 4 3 2 6 5 1 6
NO
5 2 5 2 3 5 3 5 4 3 4 3 6 6 6 6 1 1 1 1 4 2 4 2
YES
2 4 2 4 4 5 4 5 5 1 5 1 3 3 3 3 6 6 6 6 2 1 2 1
YES
3 5 3 5 5 1 5 1 1 4 1 4 6 6 6 6 2 2 2 2 3 4 3 4
YES
2 1 2 1 4 2 4 2 6 4 6 4 5 5 5 5 3 3 3 3 6 1 6 1
YES
4 4 2 2 1 1 1 1 5 5 6 6 2 6 2 6 4 5 4 5 3 3 3 3
YES
1 1 2 2 4 4 4 4 5 5 6 6 5 1 5 1 6 2 6 2 3 3 3 3
YES
2 2 6 6 4 4 4 4 1 1 5 5 1 2 1 2 5 6 5 6 3 3 3 3
YES
2 2 3 3 6 6 6 6 4 4 1 1 3 1 3 1 2 4 2 4 5 5 5 5
YES
6 6 6 6 4 4 3 3 5 5 5 5 3 3 1 1 2 2 4 4 1 1 2 2
YES
2 2 2 2 4 4 5 5 3 3 3 3 6 6 4 4 5 5 1 1 1 1 6 6
YES
1 1 1 1 5 5 6 6 3 3 3 3 4 4 5 5 6 6 2 2 2 2 4 4
YES
4 4 4 4 2 2 3 3 1 1 1 1 3 3 6 6 5 5 2 2 6 6 5 5
YES
1 1 1 1 2 2 3 3 6 6 6 6 5 5 4 4 3 3 2 2 4 4 5 5
NO
1 1 2 2 3 3 1 1 2 2 3 3 4 4 4 4 5 5 5 5 6 6 6 6
NO
5 5 5 5 1 1 2 2 6 6 6 6 4 4 3 3 3 3 4 4 2 2 1 1
NO
a = input().split()

c1 = a[0] == a[1] == a[2] == a[3]
c2 = a[8] == a[9] == a[10] == a[11]
c3 = a[12] == a[13] == a[6] == a[7]
c4 = a[4] == a[5] == a[18] == a[19]
c5 = a[16] == a[17] == a[22] == a[23]
c6 = a[20] == a[21] == a[14] == a[15]

c1 = c1
c2 = c2
c7 = a[4] == a[5] == a[14] == a[15]
c8 = a[12] == a[13] == a[22] == a[23]
c9 = a[20] == a[21] == a[18] == a[19]
c10 = a[16] == a[17] == a[6] == a[7]

c11 = a[4] == a[5] == a[6] == a[7]
c12 = a[20] == a[21] == a[22] == a[23]
c13 = a[8] == a[9] == a[17] == a[19]
c14 = a[16] == a[18] == a[0] == a[1]
c15 = a[2] == a[3] == a[12] == a[14]
c16 = a[13] == a[15] == a[10] == a[11]

c11 = c11
c12 = c12
c17 = a[8] == a[9] == a[12] == a[14]
c18 = a[13] == a[15] == a[0] == a[1]
c19 = a[2] == a[3] == a[17] == a[19]
c20 = a[16] == a[18] == a[10] == a[11]

c21 = a[12] == a[13] == a[14] == a[15]
c22 = a[16] == a[17] == a[18] == a[19]
c23 = a[8] == a[10] == a[5] == a[7]
c24 = a[4] == a[6] == a[1] == a[3]
c25 = a[0] == a[2] == a[20] == a[22]
c26 = a[21] == a[23] == a[9] == a[11]

c21 = c21
c22 = c22
c27 = a[8] == a[10] == a[20] == a[22]
c28 = a[21] == a[23] == a[1] == a[3]
c29 = a[0] == a[2] == a[5] == a[7]
c30 = a[4] == a[6] == a[9] == a[11]

case1 = c1 and c2 and c3 and c4 and c5 and c6
case2 = c1 and c2 and c7 and c8 and c9 and c10
case3 = c11 and c12 and c13 and c14 and c15 and c16
case4 = c11 and c12 and c17 and c18 and c19 and c20
case5 = c21 and c22 and c23 and c24 and c25 and c26
case6 = c21 and c22 and c27 and c28 and c29 and c30

if case1 or case2 or case3 or case4 or case5 or case6:
    print('YES')
else:
    print('NO')
