1.

Ankush challenges Ankit to complete his code which implements the functionality of checking if the first and last name of a student is an anagram of each other or not.

An anagram of a string is another string that contains same characters, only the order of characters can be different. For example, “act” and “tac” are anagram of each other. Invest your time to study the locked code and complete it accordingly.

Input:
The first line contains the number of test cases, each test case consists of one line input containing 2 space separated strings representing the first and last name of the student.

Output:
For each test case T, the output should consist of a single line - ANAGRAM or NOT ANAGRAM depending upon if the 2 given strings are anagram of each other or not.

Constraints:
1 <= T <= 100

Example:
Input:

2
rahul garg 
ankit kitan

Output:
NOT ANAGRAM
ANAGRAM

2.

Stuti is a very good dancer. She is preparing for her performance at her college fest. But unfortunately she has to submit her maths assignment just before the college fest. She has completed most of the problems but she is stuck at one. She has no clue how to solve this problem. Now she is in a dilemma of whether to prepare for her performance or try to solve that problem. She is very tensed. She needs your help to solve this problem.

Problem contains a number N(1<= N <= 1000000000). If this number is the sum of first 's' natural number then print 's' otherwise print -1.

INPUT

First line denotes the number of test cases(1<= T <= 100).

And next T lines contains a single integer.

 

OUTPUT

For each test case print a single integer in next line.

3.

Given a priority queue (max heap) and Q queries to be performed on priority queue. The task is to perform operations based on queries.
1. p : query to push element (x, given with query) to priority_queue and print size.
2. pp : query to pop element from priority_queue and print size.
3. t : query to return top element of priority_queue, if empty -1 will be printed.

Input Format:
First line of input contains number of testcases T. For each testcase, first line of input contains Q queries. Next Q lines contains Q queries.

Output Format:
For each testcase, perform the required operation, and print if anything required.

Your Task:
Your task is to complete the functions push_pq(), pp_pq() and pq_top(), so that the queries are performed.

Constraints:
1 <= T <= 100
1 <= Q <= 100

Example:
Input:

1
5
p 5
p 3
p 1
t
pp
Output:
1
2
3
1
2

4.

Given a vector of N positive integers. Your task is to print the vector elements in reverse order.

 

Input:
First line of input contains number of testcase, T. For each testcase, first line of input contains N, size of vector. Next line contains N elements seperated by space.

Output:
For each testcase, print the vector elements in reverse order.

Constraints:
1 <= T <= 100
1 <= N <= 106
1 <= V[i] <= 1012

User Task:
Your task is to complete the function reverseIterator() which accepts it1 and it2 as two parameters and prints the vector elements in reverse order.Example:
Input:

1
5
1 2 3 4 5
Output:
5 4 3 2 1

5.

Iterators are used to iterate over vectors, maps, sets etc. Here we will learn to iterate over a vector from begin to end.
You are given a vector V of size n. You need print its elements.

Input Format:
The first line of input contains T denoting the number of testcases. T testcases follow. Each testcase contains two lines of input. The first line contains n denoting the size of the array. The second line contains the elements of the vector.

Output Format:
For each testcase, in a new line, print the required output.

Your Task:
Since this is a function problem, you don't need to take any input. Just complete the function iter() that takes two iterators as parameters.

Constraints:
1 <= T <= 100
1 <= n <= 107
0 <= V<= 107

Examples:
Input:

1
5
1 2 3 4 5
Output:
1 2 3 4 5