Given a Queue Q containing N elements. The task is to reverse the Queue. Your task is to complete the function rev(), that reverses the N elements of the queue.

Input Format: 
The first line of input contains an integer T denoting the Test cases. Then T test cases follow. The first line contains N which is the number of elements which will be reversed. Second line contains N space seperated elements.

Output Format:
For each testcase, in a new line, print the reversed queue.

Your Task:
This is a function problem. You only need to complete the function rev that takes a queue as parameter and returns the reversed queue. The printing is done automatically by the driver code.

1 ≤ T ≤ 100
1 ≤ N ≤ 105
1 ≤ elements of Queue ≤ 105

Input : 
4 3 1 10 2 6
4 3 2 1 

Output : 
6 2 10 1 3 4
1 2 3 4


** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Mohit Gupta
Author: support3

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.

Need help with your code? Please use, generate link and share the link here.

to report an issue on this page.