1.

Pairs and vectors can be used together to achieve some amazing results. Here we will learn to use a vector that holds pairs.
You are given a vector V of size n. The vector hold pair of integers. Example V={(1,2),(3,4)...}. Now, you need to sum the second 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 2*n elements.

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 provided function sum().

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

2.

You are given a vector V of size n. You need to sort it and reverse it.

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 space seperated 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 provided functions sortVector() and reverseVector().

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
5 4 3 2 1

3.

Given only a pointer to a node to be deleted in a singly linked list. Print the whole Linked List after deletion.

Input:
The first line of input contains an element T, denoting the no of test cases. Then T test cases follow. Each test case contains two lines. The first line of each test case contains two integers N denoting the no of elements of the linked list and P denoting the number of the node which is to be deleted (starting from 0) . Then in the next line are N space separated values of the linked list.

Output:
The output for each test case will be the space separated elements of the updated linked list.

Constraints:
1<=T<=100
2<=N<=103
0<=P<(N-1)
Example(To be used only for expected output):

Input:
2
5 2
1 2 3 4 5
4 0
1 3 6 9

Output:
1 2 4 5
3 6 9

 

4.

Mytat created a random series and given a name Mytat-onacci series. Given four integers A, B, C, N. A, B, C represents the first three numbers of Mytat-onacci series. Find the Nth number of the series. The nth number of Mytat-onacci series is a sum of the last three numbers (summation of N-1th, N-2th, and N-3th Mytat-onacci numbers)

Input:
1. The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
2. The first line of each test case contains four space-separated integers A, B, C, and N.

Output: For each test case, print Nth Mytat-onacci number

Constraints:
1. 1 <= T <= 3
2. 1 <= A, B, C <= 100
3. 4 <= N <= 10

Example:
Input:

3
1 3 2 4
1 3 2 5
1 3 2 6

Output:
6
11
19

5.

Given only a pointer to a node to be deleted in a singly linked list. Print the whole Linked List after deletion.

Input:
The first line of input contains an element T, denoting the no of test cases. Then T test cases follow. Each test case contains two lines. The first line of each test case contains two integers N denoting the no of elements of the linked list and P denoting the number of the node which is to be deleted (starting from 0) . Then in the next line are N space separated values of the linked list.

Output:
The output for each test case will be the space separated elements of the updated linked list.

Constraints:
1<=T<=100
2<=N<=103
0<=P<(N-1)
Example(To be used only for expected output):

Input:
2
5 2
1 2 3 4 5
4 0
1 3 6 9

Output:
1 2 4 5
3 6 9

6.

In any object-oriented programming language, Overriding is a feature that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its super-classes or parent classes. When a method in a subclass has the same name, same parameters or signature and same return type(or sub-type) as a method in its super-class, then the method in the subclass is said to override the method in the super-class.

Consider the following parent class :

class Parent
{
    void show(int p)
    {
     System.out.print(p+" ");
    }
    void print(int q){
        System.out.print(q+" ");
    }
}

Also given a class named child which inherits from Parent class 

class Child extends Parent
{
    @Override
    void show(int p) { System.out.print(p+" "); }

Your task is to create a method named print (which takes one integer as input ) in class Child which overrides the method print of the Parent class such that its prints the square of the input integer. In Main function instance of both classes are made and all methods are called in the editor.

Input:
The first line of input contains an integer T denoting the no of test cases then T test cases follow. First line of each test case contains four integers p,q,r,s.

Output:
Print the required output.

Constraints:
1<=T<=100
1<=p,q,rs<=104

Example:
Input:

1
1 2 3 4

Output:
1 2 3 16

7.

Given a 2D array, find the maximum sum subarray in it. For example, in the following 2D array, the maximum sum subarray is highlighted with blue rectangle and sum of this subarray is 29.

Input:
First line of every test case consists of T test case. First line of every test case consists of 2 integers R and C , denoting number of rows and columns. Second line consists of R*C spaced integers denoting number of elements in array.

Output:
Single line output, print the Max sum forming a rectangle in a 2-D matrix

Example:
Input:

1
4 5
1 2 -1 -4 -20 -8 -3 4 2 1 3 8 10 1 3 -4 -1 1 7 -6
Ouptut:
29

8.

There are many times when when need to take input of a string that contains multiple words.
Here, we will learn how to take input of a string that comprises of multiple words. Also, we will learn to clear the input buffer. Your task is to take input of strings and integers and produce the output.

Note : Use std:cingetline()cin.ignore().
Note 2: When cin is followed by getline, it creates a problem that can be circumvented by using cin.ignore. You can read more about it here

Input Format:
First line of input contains T,  number of testcases. For each testcase, there will be three lines of input. First line contains stringsecond line contains integer, and third line again contains string.

Output Format:
For each testcase, print the variables in same order as taken in input.

User Task:
Your task is to complete the function getLineAndIgnore() to take input of strings and learn how and when to use cin.ignore().

Example:
Input:
1
hello world
5
hello

Output:
hello world
5
hello

9.

Here, we'll learn the delete keyword that's used to clear the dynamically allocated memory in CPP.

Given a dynamic array A of size N. The task is to find the sum of array elements.

Input Format:
First line of input contains number of testcases T. For each testcase, there will two line of input, first of which contains N, size of array. Next line contains N integers.

Outpu Formatt
For each testcase, output the sum of array elements and in next line prints the first array element(A[0]).

Your Task:
Just comment the line that is deallocating the array.

Constraints:
1 <= T <= 10
1 <= N <= 100
1 <= A[i] <= 105

Example:
Input:

1
5
1 2 3 4 5

Output:
15
1

Explanation:
Testcase 1:
 Sum of array elements is 15 (1 + 2 + 3 + 4 + 5). The first element is 1.

10.

Given an array that stores all number from 1 to N (both inclusive and sorted).

The task is to do following operations on array elements :
UNION X Z : Do union of x and z. Parent of z will become parent of x.
FIND X: Find the parent of X and print it.
Note: Initially all are the parent of themselves.

Input:
First line consists of T test cases. First line of every test case consists of 2 integers N and K, denoting the size of array and number of queries. Second line consists of K queries, consisting of a string UNION or FIND , for union input two integers as input and to find take one integer as input.

Output:
For every FIND query print its parent.

Constraints:
1<=T<=100
1<=N,K<=100

Example:
Input:

1
5 4
FIND 4 FIND 1 UNION 3 1 FIND 3
Output:
4 1 1