11294 - Array Swapping   

Description

In this problem, you are given an array, and you are asked to operate several swapings to these elements.

The operation is simple. You will be asked to "Swap N elements in location S and location T". There are several operations, and you have to operate them one by one. In a operation, you may assume that there will not be any overlaps in the ranges from location S and T, and the range will always fit the array size.

 

Hint:

You may wrote a simple function void swap_array( int *loc_S, int *loc_T, int N ) to do the operation.

Input

There is ony one in case in the test case.

The first line contains an integer M, which is the size of array. M is not larger than 20.

The second line has M integers, which is the original contains of the array. These integers are ranged in [0,99].

The third line contains an integer O, denoting the number of operations. There will be no more than 10 operations.

The following O lines contains 3 integers, N, S and T. You have to swap N integers from location S to location T. S and T are in the range [0,M-1].

Output

Print the final status of the array.

You have to separate elements by spaces in between, and remember to add the newline symbol at the end of output.

Sample Input  Download

Sample Output  Download

Tags




Discuss