Problem H
Headline Heat

To smoothen the waves of conflict in this ocean of rage, a newly appointed authority is tasked with proofreading media coverage of GCPC and Winter Contest to prevent uneven coverage.
Input
The input consists of:
-
One line with the number of universities $n$, rivalries $m$, and articles $k$.
($1\leq n,m,k\leq 10^5$) -
$n$ lines containing the name of a university $p_i$.
-
$m$ lines containing two integers $u,v$, meaning that universities $u$ and $v$ are rivals.
($1\leq u,v \leq n, u\neq v$) -
$k$ lines containing a news article $t_i$.
If a university $u$ is a rival of university $v$, then $v$ is also a rival of $u$. Moreover, there are no duplicate rivalries.
Names and articles are strings of lowercase Latin letters and spaces. The first and last character of a name or article are never a space. Names can overlap and be contained in other names.
The summed length of all names and articles is at most $10^6$, i.e. $\sum _{i=1}^{n} |p_i| + \sum _{i=1}^{k} |t_i| \leq 10^6$.
Output
For each article, output “no” if it will draw the wrath of at least one coach and “yes” otherwise.
Sample Input 1 | Sample Output 1 |
---|---|
3 1 4 hpi fau kit 1 3 kit destroys hpi at wintercontest gcpc is great team moshpit from hpi beats kit teams whats the abbreviation for university of erlangen nuremberg |
yes yes no yes |
Sample Input 2 | Sample Output 2 |
---|---|
6 3 5 uds cu tum rwth uni ulm uni 4 1 2 5 1 3 last gcpc rwth had a team in top ten two places behind tum who is team debuilding from constructor university bremen top ten teams last year are from kit cu uds hpi tum and rwth uni ulm cu uni ulm sunday alright lets go |
no yes no no yes |