CF763B.Timofey and rectangles

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane nn rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other.

Help Timofey to color his rectangles in 44 different colors in such a way that every two rectangles touching each other by side would have different color, or determine that it is impossible.

Two rectangles intersect if their intersection has positive area. Two rectangles touch by sides if there is a pair of sides such that their intersection has non-zero length

The picture corresponds to the first example

输入格式

The first line contains single integer nn ( 1<=n<=51051<=n<=5·10^{5} ) — the number of rectangles.

nn lines follow. The ii -th of these lines contains four integers x1x_{1} , y1y_{1} , x2x_{2} and y2y_{2} ( -10^{9}<=x_{1}<x_{2}<=10^{9} , -10^{9}<=y_{1}<y_{2}<=10^{9} ), that means that points (x1,y1)(x_{1},y_{1}) and (x2,y2)(x_{2},y_{2}) are the coordinates of two opposite corners of the ii -th rectangle.

It is guaranteed, that all sides of the rectangles have odd lengths and rectangles don't intersect each other.

输出格式

Print "NO" in the only line if it is impossible to color the rectangles in 44 different colors in such a way that every two rectangles touching each other by side would have different color.

Otherwise, print "YES" in the first line. Then print nn lines, in the ii -th of them print single integer cic_{i} ( 1<=ci<=41<=c_{i}<=4 ) — the color of ii -th rectangle.

输入输出样例

  • 输入#1

    8
    0 0 5 3
    2 -1 5 0
    -3 -4 2 -1
    -1 -1 2 0
    -3 0 0 5
    5 2 10 3
    7 -3 10 2
    4 -2 7 -1
    

    输出#1

    YES
    1
    2
    2
    3
    2
    2
    4
    1
    
首页