human
Can you provide a Python code to print «YES» (without quotes) if it's possible to solve cube using one rotation and «NO» (without quotes) otherwise given the following:
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:


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.
Solve the task in PYTHON.
assistant
#Here is Python code to print «YES» (without quotes) if it's possible to solve cube using one rotation and «NO» (without quotes) otherwise.

def pba():
    print 'yes' if raw_input().count('0')>=6 else 'no'

def pbb():
    import itertools
    def doable(cube,num):
        for perm in itertools.permutations(cube,len(num)):
            sweg=True
            for i in range(len(num)):
                if num[i] not in perm[i]:
                    sweg=False
            if sweg:
                return True
        return False
    cube=[]
    ncubes=int(raw_input())
    for _ in range(ncubes):
        cube.append(raw_input().split())
    i=1
    while doable(cube,str(i)):
        i+=1
    print i-1

def pbc():
    cube=raw_input().split()
    configs=[[1,3,6,8,5,7,10,12,9,11,21,23,2,4,22,24,13,14,15,16,17,18,19,20],
             [1,3,21,23,22,24,10,12,9,11,6,8,5,7,2,4,13,14,15,16,17,18,19,20],
             [13,14,7,8,5,6,19,20,17,18,23,24,21,22,15,16,9,10,11,12,1,2,3,4],
             [5,6,15,16,17,18,7,8,21,22,19,20,13,14,23,24,1,2,3,4,9,10,11,12],
             [1,2,17,19,18,20,9,10,11,12,14,16,13,15,3,4,5,6,7,8,21,22,23,24],
             [1,2,14,16,13,15,9,10,11,12,17,19,18,20,3,4,5,6,7,8,21,22,23,24]]
    goodconf=False
    for config in configs:
        assert sorted(config)==range(1,25)
        goodtmp=True
        for i in range(0,24,4):
            if not cube[config[i]-1]==cube[config[i+1]-1]==cube[config[i+2]-1]==cube[config[i+3]-1]:
                goodtmp=False
        if goodtmp:
            goodconf=True
    if goodconf:
        print 'YES'
    else:
        print 'NO'
pbc()