typedef long long ll; #include using namespace std; int main() { ll n; std::cin >> n; vector> xy1(n); vector> xy2(n); pair a = {2,8}; pair b = {3,9}; pair c = {7,9}; for (int i = 0; i < n; i++) { std::cin >> xy1[i].first>>xy1[i].second>>xy2[i].first>>xy2[i].second; if(a == xy1[i]){ a = xy2[i]; }else if(b == xy1[i]){ b = xy2[i]; }else if(c == xy1[i]){ c = xy2[i]; } } if(a == (pair){5,8} && b == (pair){4,8} && c == (pair){6,8}){ std::cout << "YES" << std::endl; }else{ std::cout << "NO" << std::endl; } }