AppOfficer's AO-Craft

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

P1012 AppOfficer's AO-Craft

Difficulty: \(\color{brown}550\)

Problem Statement

All young children know MineCraft, an interesting game that all children enjoy.

It has a large composite list. For example:
pic1.png
4 woodplanks make a workbench;
pic2.png
3 roundstones and 2 woodsticks can make a stone-axe;

AppOfficer, the founder of AOCode, decided to create a new game similar to MineCraft, called AO-Craft.

Here the composite interface is a \(3 \times 3\) square, and we use wdplnk as woodplank, wdstck as woodstick, rndstn as roundstone, irnbar as iron bar, gldbar as gold bar, diamnd as diamond, redstn as redstone, wdcoal as woodcoal. These are the basic elements.

Here, for example, the composite interface of workbench is:

\(\rm wdplnk\) \(\rm wdplnk\) \(\rm ----\)
\(\rm wdplnk\) \(\rm wdplnk\) \(\rm ----\)
\(\rm ----\) \(\rm ----\) \(\rm ----\)

AppOfficer knows a large composite list, and he needs Radar to conbine them to the game. Then, AppOfficer needs Radar to look into the game and tell him what elements do the things need.

Can you help Radar do this?

Constraints

  • \(N\) is the number of the new elements that need combining.
  • \(com_i(1 \le i \le N)\) is the composite interface of the \(i^{\rm th}\) element.
  • \(T\) is the number of the elements that you need to output.
  • \(qs_i\) is the element name you need to output the composite interface of.
  • \(1 \le N \le 100000\)
  • \(com_i = \text{char}[3][3][6] (1 \le i \le N) + \text{string}(\text{name})\)
  • \(1 \le T \le 100000\)
  • \(qs_i = \text{string}(\text{testname})\)

Input

\(N\)

\(com_1\)
\(com_2\)
\(\ \ \ \ \vdots\)
\(com_N\)
\(T\)
\(qs_1\)
\(qs_2\)
\(\ \ \vdots\)
\(qs_T\)

Output

Output the composite interface of \(qs_i(1 \le i \le T)\).

Samples

Input 1

3
wdplnk wdplnk ------
wdplnk wdplnk ------
------ ------ ------
workbench
rndstn rndstn ------
rndstn wdstck ------
------ wdstck ------
stone-axe
diamnd diamnd diamnd
diamnd diamnd diamnd
diamnd diamnd diamnd
diamond-block
4
workbench
stone-axe
diamond-block
stone-axe

Output 1

wdplnk wdplnk ------
wdplnk wdplnk ------
------ ------ ------
rndstn rndstn ------
rndstn wdstck ------
------ wdstck ------
diamnd diamnd diamnd
diamnd diamnd diamnd
diamnd diamnd diamnd
rndstn rndstn ------
rndstn wdstck ------
------ wdstck ------

To blank places of the Interface we use ------.

Here's the explaination of the Sample 1:

  • Here \(n=3\), means we have \(3\) things that can be composited.
  • The three things are workbench, stone-axe and diamond-block - you see, there could be - in the names - and their Interfaces.
  • Here \(T=4\), means there're \(4\) queries.
  • The four things in the queries are workbench, stone-axe, diamond-block and stone-axe one by one - see, there could be several same elements in the queries - and you output the Interfaces of them.

AOCode Round #2 (Div. 2) - Rematch - AOCR #1 - With Additionals

未参加
状态
已结束
规则
ACM/ICPC
题目
7
开始于
2021-10-02 13:30
结束于
2021-10-02 16:30
持续时间
3.0 小时
主持人
参赛人数
9