Imperfect Imperial Units

아직 제출이 없습니다시간 제한4초메모리 제한1024 MB

문제

You are writing a paper for the Beta Astronomy Physics Conference about your recent discovery on grey holes. One of your collaborators has performed a huge number of measurements, which you would like to analyse in order to draw some conclusions. The only problem is: the data is measured in a wide variety of units, and to your disgust, they appear to use a mix of the imperial and metric systems. To simplify your analysis, you need to convert all these measurements into a different unit.

입력

The input consists of:

  • One line with two integers nn and qq (1n1001\leq n\leq 100, 1q10,0001\leq q\leq 10\\,000), the number of unit conversion equations and the number of queries to answer.
  • nn lines, each defining a unit conversion in the format "1 <unit> = <value> <unit>".
  • qq lines, each with a query in the format "<value> <unit> to <unit>".

In these formats, "<value>" is a floating-point number vv (0.001v10000.001 \leq v \leq 1000, with at most 99 digits after the decimal point) and "<unit>" is a string of at most 2020 English lowercase letters (a-z). A unit in a query is guaranteed to be defined in at least one unit conversion equation. Every unit can be converted into every other unit in at most one way.

출력

For every query, output the value of the requested unit, or "impossible" if the query cannot be answered.

Your answers should have a relative error of at most 10610^{-6}.