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
3
3
3
1
1
1
1
3
3
3
3
1
2
3
1
2
2
2
3
3
2
1
3
3
1
2
3
1
1
1
2
2
2
3
1
1
1
1
1
1
3
2
2
2
2
2
2
3
1
2
2
2
2
2
3
3
2
1
1
 3
3
2
2
 3
3
2
3
 2
3
3
 3
2
2
1
 5
1
1
2
2
3
 3
1
3
1
 3
1
1
3

YES
 NO
 NO
 NO
 YES
 NO
 YES
 YES
 NO
 NO
 NO
 YES
 NO
 NO
 YES
 YES
 YES
 NO
 YES
 YES
 NO
 NO
 NO
 NO
 NO
 YES
 YES
 YES
 NO
 NO
 NO
 YES
 NO
 NO
 NO

cases = input()
currentlyPlaying = [1,2]
left = 3
isPassing = True
for _ in xrange(cases):
    number = input()
    if number not in currentlyPlaying:
        print "NO"
        isPassing = False
        break
    a = currentlyPlaying.index(number)
    if a == 0:
        swap = currentlyPlaying[1]
        currentlyPlaying[1] = left
        left = swap
    else:
        swap = currentlyPlaying[0]
        currentlyPlaying[0] = left
        left = swap
if isPassing:
    print "YES"