#Lutece2833. 兔子跳

兔子跳

Migrated from Lutece 2833 兔子跳

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

大兔子喜欢在草原上跳来跳去,但是猎人在草原上设置了 nn 个陷阱,大兔子必须远离这些陷阱。

草原可以用二维直角坐标系来描述,可以把大兔子看作是一个点,把陷阱看作是平面上的矩形。矩形的边与坐标轴平行,因此可以用矩形左下角的点 (x1,y1)(x_1,y_1) 和右上角的点 (x2,y2)(x_2,y_2) 来描述这个矩形,坐标均为整数。

大兔子总是沿着 xx 轴或 yy 轴的方向跳跃,每次跳跃的长度为整数 dd。也就是说,如果大兔子位于 (x,y)(x,y),那么他可以跳到 (xd,y)(x-d,y)(x+d,y)(x+d,y)(x,yd)(x,y-d)(x,y+d)(x,y+d)

大兔子想找到一个点,当他从这个点开始跳,无论怎么跳都不会掉进陷阱。请告诉大兔子是否存在这样的点。

Input

第一行包含两个整数 nndd (1n,d1051\le n,d\le 10^5),表示陷阱的数量和每一跳的长度。

在接下来的 nn 行每行包含四个整数 x1,y1,x2,y2x_1,y_1,x_2,y_2 (109x1,y1,x2,y2109-10^9 \le x_1,y_1,x_2,y_2\le 10^9, x1<x2x_1<x_2, y1<y2y_1<y_2),表示矩形的左下角的点和右上角的点。矩形间可以有交集。

Output

如果存在满足条件的点,输出 YES,否则输出 NO

Samples

2 2
1 1 2 2
2 2 3 3
YES
1 1
1 1 2 2
NO

Resources

2022 UESTC ICPC Training for Math and Geometry