Every web page is identified by a string called a URL (Uniform Resource Locator). Web pages are written in HTML (Hypertext Markup Language), which uses markup codes to control formatting and to define links to other pages. For this problem we care only about the markup that defines links to other pages.
A link inside a page is written as <A HREF="URL">, where URL is the address of another page. A user viewing a page that contains a link may click the link to view the linked page.
Write a program that reads several web pages together with their URLs. For every link on every page, print the URL of the page that contains the link and the URL of the page it refers to, in the form Link from <source> to <target>.
After all pages, you are given several pairs of URLs. For each pair, assume you are currently viewing the page named by the first URL, and decide whether, by clicking a sequence of links, you can reach the page named by the second URL. If you can, print Can surf from here to there.; otherwise print Can't surf from here to there., where here and there are the two URLs of the pair. Already viewing a page counts as being able to view it, so every page can reach itself.
The first line contains an integer $n \le 100$, the number of web pages. Each web page is given as a line with its URL followed by several lines containing the page itself. A URL is up to 80 non-blank printable characters and contains no quotation marks. The first line of every page starts with <HTML> and its last line is </HTML>. Each page contains up to 100 links in the format described above, and each link lies entirely within one line. Every URL that appears in a link is the URL of one of the pages given in the input. The markup keywords A, HREF, and HTML appear only in uppercase.
After the $n$ pages come several pairs of lines, each pair giving two URLs as described above. The very last line of the input is The End.
For each query pair, print the appropriate line described above: Can surf from <first> to <second>. if the second page is reachable from the first, otherwise Can't surf from <first> to <second>.