P9764 [ROIR 2021] Rope (Day 1)

Background

**Translated from [ROIR 2021](http://neerc.ifmo.ru/school/archive/2020-2021.html) Day 1 T4 [ Антенна](http://neerc.ifmo.ru/school/archive/2020-2021/ru-olymp-regional-2021-day1.pdf)**。

Description

There are $n$ ropes. The $i$-th rope has length $s_i$ cm and has $m_i$ nodes. The $j$-th node is located at $p_{i,j}$ cm from the left endpoint of the rope. Try to construct a plan to connect the ropes from left to right. Let the order of ropes in this plan be $q$. Clearly, $q$ is a permutation of $1 \sim n$, and it must satisfy the following requirement: after connecting the right endpoint of rope $q_i$ to the left endpoint of rope $q_{i+1}$ $(1\le i

Input Format

The first line contains an integer $n$. The next $2\times n$ lines are: - Line $2\times i(1\le i\le n)$ contains two integers $m_i$ and $s_i$. - Line $2\times i+1(1\le i\le n)$ contains $m_i$ integers $p_{i,j}$.

Output Format

If a plan can be constructed, output `Yes`, and then output one more line containing $n$ integers $q_i$. If there is no solution, output `No`.

Explanation/Hint

[Sample Explanation 1]: ![](https://s1.ax1x.com/2023/04/28/p9lIjVH.png) ![p9lIOqe.png](https://s1.ax1x.com/2023/04/28/p9lIOqe.png) [Constraints]: For all subtasks, $1\le n\le 10^5$, $1\le m_i\le 10^5$, $0\le s_i\le 10^9$, $0\le p_{i,1}