Hide

Problem J
Jigsaw Present

/problems/jigsawpresent/file/statement/en/img-0001.png
Julia is preparing a present for James. She will give him some of her $n$ jigsaw puzzles, where puzzle $i$ ($1 \leq i \leq n$) consists of $x_i$ pieces and has a difficulty $y_i$ (can be negative if the puzzle is very easy).

James is already very excited and would like to know in advance what he will get. Therefore, he used some of his criminal energy to gather information about the gift. In particular, he has managed to obtain an encrypted message containing the total difficulty and total number of pieces of all the puzzles that he will receive.

Now he wonders whether it is worth spending some more time to decrypt the message. After all, it might be that this information is not enough to uniquely determine his gift. Since he was never good at these computer thingies, James asked for your assistance. Help him find out whether it is worth decrypting the message or not. If the answer is negative, you have to find two distinct gifts that result in the same encrypted message.

Input

The input consists of

  • One line with an integer $n$ ($2 \leq n \leq 4\, 096$), the number of puzzles that Julia owns.

  • $n$ lines, the $i$th of which contains two integers $x_i$ and $y_i$ ($1 \leq x_i \leq 4\, 096$, $\left|y_i\right| \leq 4\, 096$), the number of pieces of puzzle $i$ and the difficulty of puzzle $i$.

Output

If James can uniquely determine his gift, then print “yes”. Otherwise, you should print “no” followed by two lines, where each line contains the description of a present. The description of a present should start with an integer $k$, the number of puzzles, followed by $k$ distinct integers, the indices of the puzzles.

Note that the two presents have to be distinct, meaning that there should be at least one puzzle that is contained in one present but not the other.

If there are multiple presents that result in the same encrypted message, you can print any of them.

Note

In the first sample case, the first present consists of puzzles $2$, $4$, and $5$. The total number of pieces is $3 + 1 + 1 = 5$ and the total difficulty is $2 + (-3) + 1 = 0$. The second present consists of puzzles $1$ and $3$. The total number of pieces is $2 + 3 = 5$ and the total difficulty is $(-1) + 1 = 0$. Thus, if James only knows the total number of pieces and the total difficulty, he cannot recover his present. So it is not worth to decode the message.

In the second sample case, no matter what gift Julia prepares, if James knows the total number of pieces and the total difficulty, he can recover his present. So he should decode the message.

Sample Input 1 Sample Output 1
5
2 -1
3 2
3 1
1 -3
1 1
no
3 2 4 5
2 1 3
Sample Input 2 Sample Output 2
4
2 -1
3 2
3 1
1 -3
yes

Please log in to submit a solution to this problem

Log in