# 249. Company

## Task Description

Write a program to determine the relation between two employees in a company. Every employee is described by a record like the following.

struct employee {  int id;  char first_name[32];  char last_name[32];  int boss_id;};


The id is a unique identification number of an employee. The first_name and last_name are the names of an employee. The boss_id is the identification number of the boss of the employee. Two employees have one of the following relation.

• If an employee A can follow the "boss" relation to an employee to another employee B, then A is a subordinate of B, and B is a supervisor of A.
• If A and B have a common supervisor C, then A and B are colleague
• If none of the above is true, then A and B are unrelated.

• 如果員工 A 可以藉由 boss 關係找到 B，則表示 B 為 A 的上司，意即 A 是 B 的下屬。
• 如果 A 和 B 有共同的上司，則 A 和 B 是同事。
• 如果上述觀係都不成立，則 A 和 B 之間沒有關係。

## Input

The first line of the input is the number of employees $n$, which is no more than 32. The next $n$ lines are the information of the employees. The next line is the number of queries $m$. Each of the next $m$ has the names of two employees. Since $m$ could be quite large so you must process a query once you read it. These two names will be different.

## Output

The output has $m$ lines. Each line indicates the relation between the two employees.

## Sample input

6100 John Smith 200200 Adam Joshson 300300 Jane Washington 300400 Mary Miller 300500 Eric Page 500600 James Clark 5004John Smith Jane WashingtonJane Washington Adam JoshsonAdam Joshson Mary MillerMary Miller James Clark


## Sample output

subordinatesupervisorcolleagueunrelated


## Testdata Set

Download Testdata