---
{"category_name":"easy","problem_code":"ARRT","problem_name":"Array Rotation Returns","problemComponents":{"constraints":"- $1 \\leq T \\leq 100$\n- $1 \\leq N \\leq 10^5$\n- $1 \\leq A_i, B_i \\leq 2 \\cdot N$ for each valid $i$\n- the sum of $N$ over all test cases does not exceed $2 \\cdot 10^5$\n","constraintsState":true,"subtasks":"**Subtask #1 (100 points):** original constraints\n","subtasksState":true,"inputFormat":"- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.\n- The first line of each test case contains a single integer $N$.\n- The second line contains $N$ space-separated integers $A_1, A_2, \\ldots, A_N$. \n- The third line contains $N$ space-separated integers $B_1, B_2, \\ldots, B_N$. \n","inputFormatState":true,"outputFormat":"For each test case, print a single line containing $N$ space-separated integers $C_1, C_2, \\ldots, C_N$ denoting the lexicographically smallest sequence.","outputFormatState":true,"sampleTestCases":{"0":{"id":1,"input":"1\n3\n1 4 5\n1 3 4","output":"1 2 0","explanation":"**Example case 1:** After rotating $B$ once, it becomes $(3,4,1)$. Now $C = (1,2,0)$. This is the lexicographically smallest of all possible sequences $C$.\n","isDeleted":false}}},"video_editorial_url":"https://youtu.be/kAnwPyavpxo","languages_supported":{"0":"CPP14","1":"C","2":"JAVA","3":"PYTH 3.6","4":"CPP17","5":"PYTH","6":"PYP3","7":"CS2","8":"ADA","9":"PYPY","10":"TEXT","11":"PAS fpc","12":"NODEJS","13":"RUBY","14":"PHP","15":"GO","16":"HASK","17":"TCL","18":"PERL","19":"SCALA","20":"LUA","21":"kotlin","22":"BASH","23":"JS","24":"LISP sbcl","25":"rust","26":"PAS gpc","27":"BF","28":"CLOJ","29":"R","30":"D","31":"CAML","32":"FORT","33":"ASM","34":"swift","35":"FS","36":"WSPC","37":"LISP clisp","38":"SQL","39":"SCM guile","40":"PERL6","41":"ERL","42":"CLPS","43":"ICK","44":"NICE","45":"PRLG","46":"ICON","47":"COB","48":"SCM chicken","49":"PIKE","50":"SCM qobi","51":"ST","52":"SQLQ","53":"NEM"},"max_timelimit":1,"source_sizelimit":50000,"problem_author":"prasant21","problem_tester":"","date_added":"29-07-2021","tags":{"0":"ltime98","1":"observation","2":"prasant21","3":"simple"},"problem_difficulty_level":"Simple","best_tag":"","editorial_url":"https://discuss.codechef.com/problems/ARRT","time":{"view_start_date":1627745402,"submit_start_date":1627745402,"visible_start_date":1627745402,"end_date":1735669800},"is_direct_submittable":false,"problemDiscussURL":"https://discuss.codechef.com/search?q=ARRT","is_proctored":false,"visitedContests":{},"layout":"problem"}
---
### Read problem statements in [Mandarin](https://www.codechef.com/download/translated/LTIME98/mandarin/ARRT.pdf), [Bengali](https://www.codechef.com/download/translated/LTIME98/bengali/ARRT.pdf), [Russian](https://www.codechef.com/download/translated/LTIME98/russian/ARRT.pdf), and [Vietnamese](https://www.codechef.com/download/translated/LTIME98/vietnamese/ARRT.pdf) as well.
You are given a sequence $A_1, A_2, \ldots, A_N$ which contains pairwise distinct elements and a sequence $B_1, B_2, \ldots, B_N$, which also contains pairwise distinct elements (but not necessarily distinct from elements of $A$). For each valid $i$, $1 \leq A_i, B_i \leq 2 \cdot N$.
You may rotate $B$ as many times as you want. A rotation consists of moving the first element of the sequence to the end. Afterwards, let's define a sequence $C_1, C_2, \ldots, C_N$ as $C_i = (A_i + B_i) \% N$ for each valid $i$.
There are $N$ possible sequences $C$. Find the lexicographically smallest of these sequences.
**Note:** A sequence $x$ is lexicographically smaller than a different sequence $y$ if $x_iā<āy_i$, where $i$ is the smallest valid index where the sequences $x$ and $y$ differ.
<aside style='background: #f8f8f8;padding: 10px 15px;'><div>All submissions for this problem are available.</div></aside>