Under construction

Still being built. Things may change

Headline Heat

Interview

Time limit2sMemory limit1024 MB

Summary
Given university names, rival pairs, and news articles, decide for each article whether some university is mentioned fewer times than one of its rivals.
Level

Medium6 of 10

Topics
String matching, String, Graph
Solved
No attempts yet

Problem

The German ICPC scene is widely considered one of the most competitive. At least, that is what we tell our students. Countless rivalries form a web of envy, despair, glory, and triumph, played out through the endless echoes of two scoreboards: Winter Contest and GCPC. Participants tend to forget the grudges of their predecessors, but we coaches keep these petty conflicts alive between long forgotten teams. Aiming for perfect balance, we express our dedication to coaching through furious outcries on social media against every unfair news article. That is, a coach gets angry if a news article mentions a rival university more often than their own.

To calm 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 nn, rivalries mm, and articles kk. (1≤n,m,k≤1051\leq n,m,k\leq 10^5)
  • nn lines containing the name of a university pip_i.
  • mm lines containing two integers u,vu,v, meaning that universities uu and vv are rivals. (1≤u,v≤n,u≠v1\leq u,v \leq n, u\neq v)
  • kk lines containing a news article tit_i.

If university uu is a rival of university vv, then vv is also a rival of uu. No rivalry appears twice.

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 10610^6, i.e. ∑i=1n∣pi∣+∑i=1k∣ti∣≤106\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.

Examples2

  1. Example 1

    Input
    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
    
    Expected output
    yes
    yes
    no
    yes
    
  2. Example 2

    Input
    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
    
    Expected output
    no
    yes
    no
    no
    yes