EFFECTIV - It is Super Effective

no tags 

As you may know, this world is inhabited by creatures called Dokémon! For some people, Dokémon are pets. Other use them for fights.

During a Dokémon battle, two Dokémon attack each other, alternately, until one of them faints. The survivor is declared the winner.

In this problem, every Dokémon has one (and only one) type, which indicates the creature's strength. Also, all attacks made by a Dokémon are physical and cause damage to its opponent.

An attack can be regular, super effective (it causes twice as much damage of a regular attack) or not very effective (it causes half the damage of a regular attack). This classification depends on the types of the Dokémon that are fighting. The table below indicates how the attacks are classified. The character + in the i-th row and j-th column indicates that an attack made by an i-typed Dokémon against a j-typed Dokémon is super effective. The characters - and . indicate not very effective and regular attacks, respectively.

The names above the columns are abbreviated, but represent the same names in the rows, in the same order.

Effectiveness of Dokemon attacks

Bash Catchem is a young boy from Lappet Town who wishes to be a Dokémon Master one day. However, he is still studying tactics for his Dokémon battles. Your task is to help Bash to determine, given descriptions of Dokémon Battles, the effectiveness of the attacks during the battles.

Input

Each test case starts with a line containing an integer P, 1 ≤ P ≤ 151, the number of different Dokémon that exists in our world. Each of the next P lines contains the description of a Dokémon given as two strings N T, where N is the name of the creature and T is its type. Its name contains up to 15 lowercase or uppercase letters, and its type is one of the types given in the table above, not abbreviated.

The next line contain an integer Q, 1 ≤ Q ≤ P2, the number of queries. Each of the next Q lines contains names of two Dokémon, N1 N2, describing a battle. It's guaranteed that both names were described in the same test case.

The last test case is followed by a line containing the number 0.

Output

For each query, print "It's super effective!" if an attack of N1 is super effective against N2. Print "It's not very effective..." if the attacks are not very effective, or "Regular Attack." otherwise. The character ' has the decimal code 39 in the ASCII table.

Print a blank line after each test case.

Example

Input:
4
Pikaxu Electric
Squartle Water
Dullbasaur Grass
Charminder Fire
2
Pikaxu Squartle
Dullbasaur Charminder
3
Miauth Normal
Wizang Poison
Kabrada Psychic
2
Kabrada Wizang
Wizang Miauth
0

Output:
It's super effective!
It's not very effective...

It's super effective!
Regular Attack.


hide comments
Ricardo Oliveira [UFPR]: 2012-10-28 17:32:15

Ok, thank you!

:D: 2012-10-28 13:04:46

sorry, but it's definitively tutorial. Got an easy AC with super brute force algo.

Abhay Mangal: 2012-10-27 14:57:13

Gotta Catch 'Em All!


Added by:Ricardo Oliveira [UFPR]
Date:2012-10-24
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:UFPR Training session