~A~ is tangled with string ~B~; your job is to tell him if those two pieces of string are connected to each other by any means (if string ~A~ is connected to other pieces of string and one or many of those are connected to ~B~, then ~A~ is still tangled with string ~B~). His string is in such a mess that he managed to make the connections one way; they do not reciprocate.needs string for his physics ISP. However, the string he has is a huge mess, it's stuck together and a lot of it is tangled (there are many different pieces). Luckily he has the legendary TangledStringAnalyzer9000. This revolutionary machine can scan the mess, assign each piece of string a number, and tell him which pairs of string are connected! wants to check if string
The first line of input will contain the number of analyzed connections or number of pieces of string, ~N~ ~(1 \le N \le 1000)~.
The next ~N~ lines of input will contain the connection in the form,
a b, where ~a~ is the first string, ~b~ is the second string. ~1 \le a,b \le 1000~.
The last line of input will be in the form,
X Y, the pair of string pieces which will be checked to see if they are tangled or not. Each piece of string, ~a~, will only appear once as the first piece of string in a connection,
Tangled if string ~A~ is connected to string ~B~, otherwise output
3 1 2 2 3 3 1 3 2