{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eIn programming language design circles, there has been much debate about the merits of \"structural equivalence\" vs. \"name equivalence\" for type matching. Pascal purports to have \"name equivalence\", but it doesn\u0027t; C purports to have structural equivalence, but it doesn\u0027t. Algol 68, the Latin of programming languages, has pure structural equivalence. \u003cbr\u003eA simplified syntax for an Algol 68 type definition is as follows: \u003cbr\u003e\u003cbr\u003e type_def -\u0026gt; type T \u003d type_expr\u003cbr\u003e type_expr -\u0026gt; T | int | real | char | struct ( field_defs )\u003cbr\u003e field_defs -\u0026gt; T | field_defs T\u003cbr\u003e\u003cbr\u003eIn this syntax, T is a programmer-defined type name (in this problem, for simplicity, a single upper case letter). Plain text symbols appear literally in the input, and zero or more spaces may appear where there are spaces in the syntax. \u003cbr\u003e\u003cbr\u003eAlgol 68 type equivalence say that two types are equivalent if they are the same primitive type or they are both structures containing equivalent types in the same order. \u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"Input consists of several test cases. Each test case is a sequence of Algol 68 definitions, as described above, one per line. A line containing \"-\" separates test cases. A line containing \"--\" follows the last test case. \u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"The output for each case will consist of several lines; each line should contain a list of type names, all of which represent equivalent types. Each type name should appear on exactly one line of output, and the number of output lines should be minimized. The names in each list should be in alphabetical order; the lines of output should also be in alphabetical order. Output an empty line between test cases. \u003cbr\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003etype A \u003d int\r\ntype B \u003d A\r\ntype C \u003d int\r\ntype X \u003d struct(A B)\r\ntype Y \u003d struct(B A)\r\ntype Z \u003d struct(A Z)\r\ntype S \u003d struct(A S)\r\ntype W \u003d struct(B R)\r\ntype R \u003d struct(C W)\r\n--\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eA B C\r\nR S W Z\r\nX Y\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}