---
{"category_name":"easy","problem_code":"MAXDISTKT","problem_name":"Maximum Number Of Distinct Elements","problemComponents":{"constraints":"- $1 \\leq T \\leq 10^5$\n- $1 \\leq N \\leq 2 \\cdot 10^5$\n- $1 \\leq B_i \\leq N$\n- $0 \\leq A_i \\leq 10^9$\n- Sum of $N$ over all tests is atmost $10^6$.\n","constraintsState":true,"subtasks":"- 30 points : $1 \\leq R \\leq 10000$\n- 70 points : $1 \\leq R \\leq 10^9$\n","subtasksState":false,"inputFormat":"- First-line will contain $T$, the number of test cases. Then the test cases follow.\n- Each test case contains two lines of input.\n- First-line contains a single integer $N$.\n- Second-line contains $N$ space-separated integers $B_1, B_2, \\ldots, B_N$.\n","inputFormatState":true,"outputFormat":"For each test case, output in a single line $N$ space-separated integers $A_1, A_2, \\ldots, A_N$, the elements of the array $A$ such that array $C$ has the maximum number of distinct elements.\n\nIf the output array doesn\u0027t follow the constraints or the number of distinct elements in the array $C$ is less than the optimal value, you will receive a wrong answer verdict.\n","outputFormatState":true,"sampleTestCases":{"0":{"id":1,"input":"3\n3\n2 1 3\n2\n1 1\n6\n1 2 3 3 2 1","output":"3 1 2\n2 3\n0 1 2 3 4 5","explanation":"**Test Case $1$:** Array $C = \\{3 \\bmod 2, 1 \\bmod 1, 2 \\bmod 3\\} = \\{1, 0, 2\\}$. So the number of unique elements are $3$.\n\n**Test Case $2$:** Array $C = \\{2 \\bmod 1, 3 \\bmod 1\\} = \\{0, 0\\}$. So the number of unique elements is $1$.\n\n**Test Case $3$:** Array $C$ $= \\{0 \\bmod 1, 1 \\bmod 2, 2 \\bmod 3, 3 \\bmod 3, 4 \\bmod 2, 5 \\bmod 1\\}$ $= \\{0, 1, 2, 0, 0, 0\\}$. So the number of unique elements are $3$.\n\nIn all the $3$ cases, the number of unique elements can\u0027t be increased any further for any choice of the array $A$.","isDeleted":false}}},"video_editorial_url":"https://youtu.be/ihlTSvrotno","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":"utkarsh_adm","problem_tester":"","date_added":"11-10-2021","tags":{"0":"greedy","1":"simple","2":"snckql21","3":"utkarsh_adm"},"problem_difficulty_level":"Unavailable","best_tag":"","editorial_url":"https://discuss.codechef.com/problems/MAXDISTKT","time":{"view_start_date":1634668200,"submit_start_date":1634668200,"visible_start_date":1634668200,"end_date":1735669800},"is_direct_submittable":false,"problemDiscussURL":"https://discuss.codechef.com/search?q=MAXDISTKT","is_proctored":false,"visitedContests":{},"layout":"problem"}
---
### Read problem statements in [Mandarin Chinese](https://www.codechef.com/download/translated/SNCKQL21/mandarin/MAXDISTKT.pdf), [Russian](https://www.codechef.com/download/translated/SNCKQL21/russian/MAXDISTKT.pdf), and [Vietnamese](https://www.codechef.com/download/translated/SNCKQL21/vietnamese/MAXDISTKT.pdf) as well.
Given an array $B$ of length $N$, find an array $A$ of length $N$ where $0 \le A_i \le 10^9$ such that array $C$ where $C_i = A_i \bmod B_i$, $\forall i \in \{1, 2, ..., N\}$ has maximum number of distinct integers.
In case of multiple answers, print any.
<aside style='background: #f8f8f8;padding: 10px 15px;'><div>All submissions for this problem are available.</div></aside>