#include int main () { int n = 0; int a[6] = {}; int res = 0; res = scanf("%d", &n); for (int i = 0; i < 6; i++) { res = scanf("%d", a+i); } if (n < 3 || a[0] == a[2] || a[0] == a[5] || a[1] == a[2] || a[2] == a[3] || a[2] == a[4]) { printf("NO\n"); } else { printf("YES\n"); } return 0; }