CF496E Distributing Parts

Description

You are an assistant director in a new musical play. The play consists of $ n $ musical parts, each part must be performed by exactly one actor. After the casting the director chose $ m $ actors who can take part in the play. Your task is to assign the parts to actors. However, there are several limitations. First, each actor has a certain voice range and there are some parts that he cannot sing. Formally, there are two integers for each actor, $ c_{i} $ and $ d_{i} $ ( $ c_{i}

Input Format

The first line contains a single integer $n$ — the number of parts in the play ( $1\le n \le 10^5$ ) Next $n$ lines contain two space-separated integers each, $a_j$ and $b_j$ — the range of notes for the $j$-th part $( 1\le a_j \le b_j \le 10^9 )$ The next line contains a single integer $m$—the number of actors $( 1\le m \le 10^5 )$ Next $m$ lines contain three space-separated integers each $c_i,d_i$ and $k_i$,— the range of the $i$-th actor and the number of parts that he can perform ( $1\le c_i \le d_i \le 10^9$,$1\le k_i \le 10^9$ )

Output Format

If there is an assignment that meets all the criteria aboce, print a single word "YES" (without the quotes) in the first line. In the next line print $ n $ space-separated integers. The $ i $ -th integer should be the number of the actor who should perform the $ i $ -th part. If there are multiple correct assignments, print any of them. If there is no correct assignment, print a single word "NO" (without the quotes).