Ash and Obstacles
Tag(s):

## Easy, Easy, Implementation, Sorting

Problem
Editorial
Analytics

Ash dreams to become the Pokemon Master and he has prepared a training program common for all his Pokemons where they have to destroy obstacles.

In total, he has N Pokemons, and before the start, every one of them has some positive integer denoting the number of Obstacles destroyed. Pokemons are indexed from 1 to N. Let's denote the No. of Obstacles destroyed by his i-th Pokemon as A[i].

After the training ends, every Pokemon will end up with some positive integer position. Ash expects that his Pokemons will take places according to the no of obstacles destroyed.

He thinks that each student will take place equal to

1+Number of students with No. of Obstacles destroyed higher than his/her.

In particular, if Pokemon A has destroyed obstacles strictly lower then Pokemon B, A will get the strictly better position than B, and if two Pokemons have destroyed equal no of obstacles, they will share the same position.

Ash would like you to reconstruct the results by following his expectations.As he had to do this task daily he is really tired today, and he is asking for your help.

INPUT:

T will denote the number of total days

The first line contains integer N number of Ash's Pokemon.

The second line contains n numbers A1, A2, ... An where A[i]is the number of obstacles destroyed by the i-th Pokemon (1 ≤ i ≤ N).

Output:

In a single line, print the position after the end of the contest for each of N Pokemon in the same order as they appear in the input. Changing line after every test case.

CONSTRAINTS:

1<=T<=10

1<=N<=10^5

1<=A[i]<=10^18

SAMPLE INPUT
3
3
1 3 3
1
1
5
3 5 3 4 5
SAMPLE OUTPUT
3 1 1
1
4 1 4 3 1
Explanation

In the first case, Pokemon 2 and 3 are positioned first (there is no other Pokemon with higher rating), and Pokemon 1 is positioned third since there are two students with higher rating.

In the second case, first Pokemon is the only one on the contest.

In the third case, Pokemon 2 and 5 share the first position with highest rating, Pokemon 4 is next with third position, and Pokemons 1 and 3 are the last sharing fourth position.

Time Limit: 1.5 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic

## CODE EDITOR

Initializing Code Editor...

## This Problem was Asked in

Challenge Name

Beginner Practice Round 1.0

OTHER PROBLEMS OF THIS CHALLENGE
• Basic Programming > Bit Manipulation
• Basic Programming > Implementation
• Math > Basic Math
• Math > Basic Math
• Basic Programming > Implementation