{"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\u003eA \u003cspan class\u003d\"tex-font-style-it\"\u003epermutation\u003c/span\u003e of length $$$k$$$ is a sequence of $$$k$$$ integers from $$$1$$$ to $$$k$$$ containing each integer exactly once. For example, the sequence $$$[3, 1, 2]$$$ is a permutation of length $$$3$$$.\u003c/p\u003e\u003cp\u003eWhen Neko was five, he thought of an array $$$a$$$ of $$$n$$$ positive integers and a permutation $$$p$$$ of length $$$n - 1$$$. Then, he performed the following:\u003c/p\u003e\u003cul\u003e \u003cli\u003e Constructed an array $$$b$$$ of length $$$n-1$$$, where $$$b_i \u003d \\min(a_i, a_{i+1})$$$. \u003c/li\u003e\u003cli\u003e Constructed an array $$$c$$$ of length $$$n-1$$$, where $$$c_i \u003d \\max(a_i, a_{i+1})$$$. \u003c/li\u003e\u003cli\u003e Constructed an array $$$b\u0027$$$ of length $$$n-1$$$, where $$$b\u0027_i \u003d b_{p_i}$$$. \u003c/li\u003e\u003cli\u003e Constructed an array $$$c\u0027$$$ of length $$$n-1$$$, where $$$c\u0027_i \u003d c_{p_i}$$$. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eFor example, if the array $$$a$$$ was $$$[3, 4, 6, 5, 7]$$$ and permutation $$$p$$$ was $$$[2, 4, 1, 3]$$$, then Neko would have constructed the following arrays:\u003c/p\u003e\u003cul\u003e \u003cli\u003e $$$b \u003d [3, 4, 5, 5]$$$ \u003c/li\u003e\u003cli\u003e $$$c \u003d [4, 6, 6, 7]$$$ \u003c/li\u003e\u003cli\u003e $$$b\u0027 \u003d [4, 5, 3, 5]$$$ \u003c/li\u003e\u003cli\u003e $$$c\u0027 \u003d [6, 7, 4, 6]$$$ \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThen, he wrote two arrays $$$b\u0027$$$ and $$$c\u0027$$$ on a piece of paper and forgot about it. 14 years later, when he was cleaning up his room, he discovered this old piece of paper with two arrays $$$b\u0027$$$ and $$$c\u0027$$$ written on it. However he can\u0027t remember the array $$$a$$$ and permutation $$$p$$$ he used.\u003c/p\u003e\u003cp\u003eIn case Neko made a mistake and there is no array $$$a$$$ and permutation $$$p$$$ resulting in such $$$b\u0027$$$ and $$$c\u0027$$$, print \u003cspan class\u003d\"tex-font-style-tt\"\u003e-1\u003c/span\u003e. Otherwise, help him recover any possible array $$$a$$$. \u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains an integer $$$n$$$ ($$$2 \\leq n \\leq 10^5$$$)\u0026nbsp;— the number of elements in array $$$a$$$.\u003c/p\u003e\u003cp\u003eThe second line contains $$$n-1$$$ integers $$$b\u0027_1, b\u0027_2, \\ldots, b\u0027_{n-1}$$$ ($$$1 \\leq b\u0027_i \\leq 10^9$$$).\u003c/p\u003e\u003cp\u003eThe third line contains $$$n-1$$$ integers $$$c\u0027_1, c\u0027_2, \\ldots, c\u0027_{n-1}$$$ ($$$1 \\leq c\u0027_i \\leq 10^9$$$).\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eIf Neko made a mistake and there is no array $$$a$$$ and a permutation $$$p$$$ leading to the $$$b\u0027$$$ and $$$c\u0027$$$, print \u003cspan class\u003d\"tex-font-style-tt\"\u003e-1\u003c/span\u003e. Otherwise, print $$$n$$$ positive integers $$$a_i$$$ ($$$1 \\le a_i \\le 10^9$$$), denoting the elements of the array $$$a$$$.\u003c/p\u003e\u003cp\u003eIf there are multiple possible solutions, 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\u003e5\n4 5 3 5\n6 7 4 6\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3 4 6 5 7 \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\u003e3\n2 4\n3 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e-1\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\u003e8\n2 3 1 1 2 4 3\n3 4 4 2 5 5 4\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3 4 5 2 1 4 3 2 \n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eThe first example is explained is the problem statement.\u003c/p\u003e\u003cp\u003eIn the third example, for $$$a \u003d [3, 4, 5, 2, 1, 4, 3, 2]$$$, a possible permutation $$$p$$$ is $$$[7, 1, 5, 4, 3, 2, 6]$$$. In that case, Neko would have constructed the following arrays:\u003c/p\u003e\u003cul\u003e \u003cli\u003e $$$b \u003d [3, 4, 2, 1, 1, 3, 2]$$$ \u003c/li\u003e\u003cli\u003e $$$c \u003d [4, 5, 5, 2, 4, 4, 3]$$$ \u003c/li\u003e\u003cli\u003e $$$b\u0027 \u003d [2, 3, 1, 1, 2, 4, 3]$$$ \u003c/li\u003e\u003cli\u003e $$$c\u0027 \u003d [3, 4, 4, 2, 5, 5, 4]$$$ \u003c/li\u003e\u003c/ul\u003e"}}]}