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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

x = int(input())
a = [int(input()) for i in range(x)]
s = []*2
k = 0
t = 0 
t1 = 0
if a[0] == 1:
	t = 1
	t1 = 2
if a[0] == 2:
	t = 2
	t1 = 1
if a[0] == 1 and a[1] == 2:
	print("NO")
elif a[0] == 2 and a[1] == 1:
	print("NO")
else:
	for i in range(1,x-1):
		s = [t,t1]
		# if a[0] == 1 and a[1] == 2:
		# 	print("NO")
		# 	break
		# if a[0] == 2 and a[1] == 1:
		# 	print("NO")
		# 	break
		if a[i] == a[i]:
			if t == 1 and t1 == 2 and a[i] == 1:
				t = 1
				t1 = 3
			elif t == 1 and t1 == 2 and a[i] == 3:
				t = 3
				t1 = 1
			elif t == 3 and t1 == 2 and a[i] == 1:
				t = 1
				t1 = 3
			elif t == 3 and t1 == 2 and a[i] == 3:
				t = 3
				t1 = 1
			elif t == 3 and t1 == 2 and a[i] == 1:
				t = 1
				t1 = 3	
			elif t == 2 and t1 == 1 and a[i] == 2:
				t = 2
				t1 =3
			elif t == 2 and t1 == 3 and a[i] == 1:
				t = 1
				t1 = 2
		elif a[i] == t1:
			print("NO")
			k = 1
			break
		else:
			t1 = a[i]
			t = a[i]
	if i == x-2 and k == 0:
		print("YES")