Go Back
Mischievous Barath (250)
Description

Its exam time! Barath hates writing exams, and to postpone the exams, Barath has erased roll numbers from all desks! Mithil is happy too! No exams?!
But, this is SIES, so exams have to happen at any cost.
Principal Sir has given Mithil the duty to quickly arrange for an immediate fix for this problem. Also, there are many classrooms, and number of benches in each row is uneven. Hence students find it difficult to find their seat. Can you help Mithil complete this task?
(Only one student sits per bench. The seating fashion is first to last for first row and last to first for alternate rows)

Input

The first line of input contains an integer T denoting the number of test cases. Each test case consists of three lines. First line takes N for number of rows. Next line takes N space separated integers A1, A2, A3… AN for number of benches in each row. Lastly take input for roll number R.

Output

For each test case, output a single line with two space separated integers, indicating the row and bench number for given roll number.

Constraints

0 < T <= 100
0 < N <= 10
0 < Ai <= 20
0 < R <= ΣAi

Example
Copy Input

Input:
2
3
4 4 4
7
5
1 2 3 4 5
9
Output:
2 2
4 2

Explanation

1)
2)

Single Round Match #08
3 hour contest



Announcement

Problem Tags
math, logic

Supported by our Coding Partner