Given an array of elements. The task is to calculate the cumulative frequency of each element of the array.

**Input:**

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case consists of two lines. First line of each test case contains an integer N and the second line contains N space separated array elements.

**Output:**

For each test case, print the space separated cumulative frequency of each element of sorted array in new line.

**Constraints:**

1<=T<=100

1<=N<=10^{5}

1<=A[i]<=10^{5}

**Example:
Input:**

2

6

1 2 2 1 3 4

6

1 2 1 2 1 2

**Output:**

2 4 5 6

3 6

**Explanation:**

```
Input : arr[] = [1, 3, 2, 1, 2, 4]
Output :1->2
2->4
3->5
4->6
Input : arr[] = [1, 2, 1, 2, 1, 2]
Output :1->3
2->6
```

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

sabka_din_aayega | 317 |

maggiiiii | 248 |

thanuvinu94 | 211 |

Savage_19 | 206 |

Anugrah_kumar | 172 |

Bishnu Dev Panda | 803 |

sabka_din_aayega | 628 |

Anugrah_kumar | 562 |

okayboss | 561 |

maggiiiii | 531 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4925 |

Quandray | 4547 |

Login to report an issue on this page.