#include using namespace std; int main(){ int N; cin >> N; int A[2] = {2,8}; int B[2] = {3,9}; int C[2] = {7,9}; int R[4]; for (int i = 0; i < N; i++){ for (int j=0; j <4; j++) cin >> R[j]; if (A[0]==R[0] && A[1]==R[1]) {A[0] = R[2]; A[1] = R[3];} else if (B[0]==R[0] && B[1]==R[1]){B[0] = R[2]; B[1] = R[3];} else if (C[0]==R[0] && C[1]==R[1]){C[0] = R[2]; C[1] = R[3];} } if (A[0]==5 && A[1]==8 && B[0]==4 && B[1]==8 && C[0]==6 && C[1]==8){ cout << "YES" << endl; } else { cout << "NO" << endl; } }