Codeforces Round 310 (Div. 1)
E
Case of Computer Network
Codeforces
2800
原题
← D→
翻译中…

Andrewid the Android is a galaxy-known detective. Now he is preparing a defense against a possible attack by hackers on a major computer network.

翻译中…

In this network are $*n*$ vertices, some pairs of vertices are connected by $*m*$ undirected channels. It is planned to transfer $*q*$ important messages via this network, the $*i*$-th of which must be sent from vertex $*s*_{*i*}$ to vertex $*d*_{*i*}$ via one or more channels, perhaps through some intermediate vertices.

翻译中…

To protect against attacks a special algorithm was developed. Unfortunately it can be applied only to the network containing directed channels. Therefore, as new channels can't be created, it was decided for each of the existing undirected channels to enable them to transmit data only in one of the two directions.

翻译中…

Your task is to determine whether it is possible so to choose the direction for each channel so that each of the $*q*$ messages could be successfully transmitted.

翻译中…

Input

翻译中…

The first line contains three integers $*n*$, $*m*$ and $*q*$ ($1 ≤ *n*, *m*, *q* ≤ 2·10^{5}$) — the number of nodes, channels and important messages.

翻译中…

Next $*m*$ lines contain two integers each, $*v*_{*i*}$ and $*u*_{*i*}$ ($1 ≤ *v*_{*i*}, *u*_{*i*} ≤ *n*$, $*v*_{*i*} ≠ *u*_{*i*}$), that means that between nodes $*v*_{*i*}$ and $*u*_{*i*}$ is a channel. Between a pair of nodes can exist more than one channel.

翻译中…

Next $*q*$ lines contain two integers $*s*_{*i*}$ and $*d*_{*i*}$ ($1 ≤ *s*_{*i*}, *d*_{*i*} ≤ *n*$, $*s*_{*i*} ≠ *d*_{*i*}$) — the numbers of the nodes of the source and destination of the corresponding message.

翻译中…

It is not guaranteed that in it initially possible to transmit all the messages.

翻译中…

Output

翻译中…

If a solution exists, print on a single line "Yes" (without the quotes). Otherwise, print "No" (without the quotes).

翻译中…

Note

翻译中…

In the first sample test you can assign directions, for example, as follows: $1 → 2$, $1 → 3$, $3 → 2$, $4 → 3$. Then the path for for the first message will be $1 → 3$, and for the second one — $4 → 3 → 2$.

翻译中…

In the third sample test you can assign directions, for example, as follows: $1 → 2$, $2 → 1$, $2 → 3$. Then the path for the first message will be $1 → 2 → 3$, and for the second one — $2 → 1$.

翻译中…

样例

Input #1
4 4 2
1 2
1 3
2 3
3 4
1 3
4 2
Output #1
Yes
InputCopy OutputCopy
Input #2
3 2 2
1 2
3 2
1 3
2 1
Output #2
No
InputCopy OutputCopy
Input #3
3 3 2
1 2
1 2
3 2
1 3
2 1
Output #3
Yes
InputCopy OutputCopy
题目信息
题号
555E
时间限制
3 s
内存限制
256 MB
标签
DFS 及类似
图论
树

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。