#include using namespace std; int main() { int n; cin >> n; int tx, ty; cin >> tx >> ty; for (int i = 1; i < n; i++) { int x, y; cin >> x >> y; if (x != tx) tx = 1e9; if (y != ty) ty = 1e9; } if (tx <= 10 || ty <= 10) puts("YES"); else puts("NO"); return 0; }