function processData(input) { //Enter your code here var a1 = input.split("\n"); var q = a1[0]*1; var j = 1; for (var qq=0;qq x2) x2 = a[i][0]; if (a[i][1] > y2) y2 = a[i][1]; } var ok = 1; for (var i=0;i x1 && a[i][0] < x2 && a[i][1] > y1 && a[i][1] < y2) { ok = 0; break; } } if (ok) console.log('YES'); else console.log('NO'); } } process.stdin.resume(); process.stdin.setEncoding("ascii"); _input = ""; process.stdin.on("data", function (input) { _input += input; }); process.stdin.on("end", function () { processData(_input); });