Back

Topology

Worth 5 point(s) - Runtime Limit: 1 seconds

Introduction

You may have heard that a donut is equivalent to a coffee mug. This is true in the eyes of a topologist of course. In topology, everything is made of infinitely stretchable rubber, which allows you to transform almost anything into anything else. Two limitations of this infinitely stretchable rubber are that you can’t rip or join it. In other words, the number of holes in an object can’t change. But, as long a sufficiently pliable dough is available, you could transform your donuts into coffee cups. You could even start a business of transmogrifying people’s donuts.

Input:
The first line will contain an integer N. The next N lines will contain the name of an object and how many holes that such object contains. The next line will contain an integer M, and the next M lines each contain two object names. Each object name will not contain spaces. Assume everything fits a 32-bit integer.

Output:
For each pair of objects, print “Topologically Equivalent”, without quotes, if they are equivalent and “Boring” if they are not topologically equivalent.

Sample Input

5
CoffeeMug 1
Donut 1
Scissors 2
Paper 0
Person 400000
4
CoffeeMug Donut
Donut CoffeeMug
Scissors Paper
Person Donut

Sample Output

Topologically Equivalent
Topologically Equivalent
Boring
Boring