ACMNSIT4 - Problem 4

no tags 

Given N strings, print the rank of the strings when sorted in lexicographical order. Rank of a string is defined as the position of string in the input starting from 1. No string is repeated in the input.

Input

First line contains N, the number of strings. The next N lines contain one string S per line.

Output

Print N integers one per line denoting the rank of strings.

Constraints

N = 100000

|S| = 20

Strings are made up lowercase letters only.

Example

Input:
4
z 
b
a
c

Output:
3
2
4
1

hide comments
Archit Mittal: 2013-03-13 14:37:32

move to tutorial


Added by:Nikunj Jain
Date:2013-03-13
Time limit:2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:ASM32-GCC MAWK BC C-CLANG C NCSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JAVA JS-MONKEY JULIA KTLN NIM OBJC OBJC-CLANG OCT PICO PROLOG PYPY PYPY3 R RACKET RUST CHICKEN SQLITE SWIFT UNLAMBDA VB.NET
Resource:Vaibhav Mittal