Under construction

Still being built. Things may change

Proper Garden

Time limit3sMemory limit256 MB

Summary
Given n tree points, find two trees at opposite corners of an axis-parallel rectangle with no other tree inside or on its border, or report that none exists.
Level

Medium7 of 10

Topics
Sorting, Geometry, Binary search
Solved
No attempts yet

Statement

Vasya has dreamed of his own garden for a long time. Recently he acquired a plot of land and set up a Cartesian coordinate system on it. He decided to plant nn trees. His friend Petya, an enthusiastic gardener, told Vasya the main rule of planting: in any rectangle of nonzero area with sides parallel to the coordinate axes, if two opposite corners hold trees, then there must be at least one other tree inside the rectangle or on its border.

Vasya has a planting plan but is not sure whether it follows the rule. Help him determine this.

Input

The first line contains an integer nn (1≤n≤2000001 \le n \le 200000). Each of the next nn lines contains two integers xix_i and yiy_i (−109≤xi,yi≤109-10^9 \le x_i, y_i \le 10^9), the coordinates of tree ii. No two trees are at the same point.

Output

If the plan satisfies the rule, print the single word YES. Otherwise, print NO on the first line, and on the second line print two different numbers ii and jj, the indices of the trees at opposite corners of a rectangle that breaks the rule. If there are several such pairs, print any of them.

Examples2

  1. Example 1

    Input
    5
    0 0
    1 0
    2 0
    1 1
    2 1
    
    Expected output
    YES
    
  2. Example 2

    Input
    4
    -1 0
    1 0
    0 1
    2 2
    
    Expected output
    NO
    3 4