import java.util.*;
import java.io.*;

import static java.lang.System.*;

public class Topology {
    public static void main(String[] args) throws IOException {
        Scanner input = new Scanner(new File("topology.dat"));

         //  We will be using maps to solve this problem.
         //  Maps are like ArrayLists, but the index (a.k.a. key) doesn't have to be an int.
         // In this problem, the index will be a String, so

        TreeMap<String, Integer> dictionary = new TreeMap<>();
        // a map of Strings to ints, specifically, the name of an object to the number of holes it has
        int dictionarySize = input.nextInt();

        while (dictionarySize-->0) {
            String object = input.next();
            int holes = input.nextInt();
            dictionary.put(object, holes); // add the object entry to the dictionary
        }
        int numQueries = input.nextInt();

        while (numQueries-->0) {
            String leftObj = input.next();
            String rightObj = input.next();

            if (dictionary.get(leftObj).equals(dictionary.get(rightObj))) {
            //  ^ if the number of holes in both objects are equal
                out.println("Topologically Equivalent");
            } else {
                out.println("Boring");
            }
        }
    }
}

results matching ""

    No results matching ""