{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\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 type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eThere are \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e phone numbers in Polycarp\u0027s contacts on his phone. Each number is a 9-digit integer, starting with a digit different from \u003cspan class\u003d\"tex-span\"\u003e0\u003c/span\u003e. All the numbers are distinct.\u003c/p\u003e\u003cp\u003eThere is the latest version of Berdroid OS installed on Polycarp\u0027s phone. If some number is entered, is shows up all the numbers in the contacts for which there is a substring equal to the entered sequence of digits. For example, is there are three phone numbers in Polycarp\u0027s contacts: \u003cspan class\u003d\"tex-span\"\u003e123456789\u003c/span\u003e, \u003cspan class\u003d\"tex-span\"\u003e100000000\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e100123456\u003c/span\u003e, then:\u003c/p\u003e\u003cul\u003e \u003cli\u003e if he enters \u003cspan class\u003d\"tex-span\"\u003e00\u003c/span\u003e two numbers will show up: \u003cspan class\u003d\"tex-span\"\u003e100000000\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e100123456\u003c/span\u003e, \u003c/li\u003e\u003cli\u003e if he enters \u003cspan class\u003d\"tex-span\"\u003e123\u003c/span\u003e two numbers will show up \u003cspan class\u003d\"tex-span\"\u003e123456789\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e100123456\u003c/span\u003e, \u003c/li\u003e\u003cli\u003e if he enters \u003cspan class\u003d\"tex-span\"\u003e01\u003c/span\u003e there will be only one number \u003cspan class\u003d\"tex-span\"\u003e100123456\u003c/span\u003e. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eFor each of the phone numbers in Polycarp\u0027s contacts, find the minimum in length sequence of digits such that if Polycarp enters this sequence, Berdroid shows this only phone number.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains single integer \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e (\u003cspan class\u003d\"tex-span\"\u003e1 ≤ \u003ci\u003en\u003c/i\u003e ≤ 70000\u003c/span\u003e) — the total number of phone contacts in Polycarp\u0027s contacts.\u003c/p\u003e\u003cp\u003eThe phone numbers follow, one in each line. Each number is a positive 9-digit integer starting with a digit from \u003cspan class\u003d\"tex-span\"\u003e1\u003c/span\u003e to \u003cspan class\u003d\"tex-span\"\u003e9\u003c/span\u003e. All the numbers are distinct.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint exactly \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e lines: the \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/span\u003e-th of them should contain the shortest non-empty sequence of digits, such that if Polycarp enters it, the Berdroid OS shows up only the \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/span\u003e-th number from the contacts. If there are several such sequences, print any of them.\u003c/p\u003e"}},{"title":"Examples","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\u003e3\n123456789\n100000000\n100123456\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e9\n000\n01\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","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\u003e4\n123456789\n193456789\n134567819\n934567891\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\n193\n81\n91\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}