Chef has  $N$ boxes arranged in a line.Each box has some candies in it,say $C[i]$. Chef wants to distribute all the candies between of his friends: $A$ and $B$, in the following way:
$A$ starts eating candies kept in the leftmost box(box at $1$st place) and $B$ starts eating candies kept in the rightmost box(box at $N$th place). $A$ eats  candies $X$ times faster than $B$ i.e. $A$ eats $X$ candies when $B$ eats only $1$. Candies in each box can be eaten by only the person who reaches that box first. If both reach a box at the same time, then the one who has eaten from more number of BOXES till now will eat the candies in that box. If both have eaten from the same number of boxes till now ,then $A$ will eat the candies in that box.
Find the number of boxes finished by both $A$ and $B$.
NOTE:- We assume that it does not take any time to switch from one box to another.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- Each testcase contains three lines of input.
The first line of each test case contains $N$, the number of boxes.
- The second line of each test case contains a sequence,$C_1$ ,$C_2$ ,$C_3$ . . . $C_N$ where $C_i$ denotes the number of candies in the i-th box.  
- The third line of each test case contains an integer $X$ .

-----Output:-----
For each testcase, print two space separated integers in a new line - the number of boxes eaten by $A$  and  $B$ respectively. 

-----Constraints-----
- $1 \leq T \leq 100$
- $1 \leq N \leq 200000$
- $1 \leq C_i \leq 1000000$
- $1 \leq X \leq 10$
- Sum of $N$ over all test cases does not exceed $300000$

-----Subtasks-----
Subtask 1(24 points):
- $1 \leq T \leq 10$
- $1 \leq N \leq 1000$
- $1 \leq C_i \leq 1000$
- $1 \leq X \leq 10$
Subtask 2(51 points): original constraints

-----Sample Input:-----
1
5
2 8 8 2 9
2

-----Sample Output:-----
4 1

-----EXPLANATION:-----
$A$ will start eating candies in the 1st box(leftmost box having 2 candies) . $B$ will start eating candies in the  5th box(rightmost box having 9 candies) .As $A's$ speed is 2 times as that of $B's$, $A$ will start eating candies in the  2nd box while $B$ would still be eating candies in the 5th box.$A$ will now start eating candies from the 3rd box while $B$ would still be eating candies in the 5th box.Now both $A$ and $B$ will finish candies in their respective boxes at the same time($A$ from the 3rd box and $B$ from 5th box). Since $A$ has eaten more number of boxes($A$ has eaten 3 boxes while $B$ has eaten 1 box) till now,so $A$ will be eating candies in the 4th box.
Hence $A$ has eaten 4 boxes and $B$ has eaten 1 box.

Difficulty: interview

Starter code:

Solutions:
import sys

# stdin = open("testdata.txt", "r")
ip = sys.stdin 

def solve(C, n, x):
 if n==1:
  return (1, 0)

 b1, b2 = 1, 1
 a , b = C[0], C[-1]
 while b1 + b2 < n:
  if a < b*x:
   a += C[b1]
   b1 += 1
  elif a > b*x:
   b2 += 1
   b += C[n-b2] 
  else:
   if b1 >= b2:
    a += C[b1]
    b1 += 1
   else:
    b2 += 1
    b += C[b2]
 return (b1, b2)

t = int(ip.readline())

for _ in range(t):
 n = int(ip.readline())
 C = list(map(int, ip.readline().split()))
 x = int(ip.readline())

 ans = solve(C, n, x)
 print(*ans)

for _ in range(int(input())):
 n = int(input())
 arr = list(map(int,input().split()))
 x = int(input())
 abox = 0
 bbox = 0
 i = 0
 j = n-1
 while n>0:
  if j!=i:
   v = x*arr[j]
   n-=1
   summ = 0
   for f in range(i,j):
    if summ+arr[f]<=v:
     summ+=arr[f]
     abox+=1
     n-=1
    else:
     arr[f] = summ+arr[f] - v
     i = f
     break
   bbox+=1
   j-=1
  elif j==i:
   if abox>=bbox:
    abox+=1
    n-=1
   else:
    bbox+=1
    n-=1

 print(abox,bbox)

for _ in range(int(input())):
 n = int(input())
 arr = list(map(int,input().split()))
 x = int(input())
 abox = 0
 bbox = 0
 i = 0
 j = n-1
 while n>0:
  if j!=i:
   v = x*arr[j]
   n-=1
   summ = 0
   for f in range(i,j):
    if summ+arr[f]<=v:
     summ+=arr[f]
     abox+=1
     n-=1
    else:
     arr[f] = summ+arr[f] - v
     i = f
     break
   bbox+=1
   j-=1
  elif j==i:
   if abox>=bbox:
    abox+=1
    n-=1
   else:
    bbox+=1
    n-=1

 print(abox,bbox)

try:
 for i in range(int(input())):
  n=int(input())
  l=list(map(int,input().split()))
  x=int(input())
  i=0
  j=n-1
  bi=0
  bj=1
  count1=l[j]*x
  while(i<j):
   if(count1>0 and i!=j):
    #print(count1,i)
    if(l[i]<=count1):
     count1=count1-l[i]
     i=i+1
     bi=bi+1
    else:
     l[i]=l[i]-count1
     count1=0
   if(count1<=0):
    #print(count1,i)
    j=j-1
    count1=count1+l[j]*x
    #print(count1,i,j)
    if(i<j):
     bj=bj+1
    if(i==j):
     if(bi>bj):
      bi=bi+1
     elif(bi<bj):
      bj=bj+1
     else:
      bi=bi+1
  print(bi,bj)
except:
 pass


try:
 for i in range(int(input())):
  n=int(input())
  l=list(map(int,input().split()))
  x=int(input())
  i=0
  j=n-1
  bi=0
  bj=1
  count1=l[j]*x
  while(i<j):
   if(count1>0 and i!=j):
    #print(count1,i)
    if(l[i]<=count1):
     count1=count1-l[i]
     i=i+1
     bi=bi+1
    else:
     l[i]=l[i]-count1
     count1=0
   if(count1<=0):
    #print(count1,i)
    j=j-1
    count1=count1+l[j]*x
    #print(count1,i,j)
    if(i!=j):
     bj=bj+1
    else:
     if(bi>bj):
      bi=bi+1
     elif(bi<bj):
      bj=bj+1
     else:
      bi=bi+1
  print(bi,bj)
except:
 pass


t=int(input())
for _ in range(t):
 n=int(input())
 l=list(map(int,input().split()))
 x=int(input())
 j=n-1
 i=0
 a=0
 b=0
 remain = 0
 while True:
  if i>j:
   break
  if i==j:
   if remain:
    a+=1
   else:
    if b>a:
     b+=1
    else:
     a+=1
   break
   
  b+=1
  d = x*l[j]+remain
  while i<j:
   d-=l[i]
   if d==0:
    remain = 0
    a+=1
    i+=1
    break
   if d<0:
    remain = d+l[i]
    break
   a+=1
   i+=1
  j-=1
 print(a,b)
   
    
   
   
  
  
  
  


try:
 for _ in range(int(input())):
  n = int(input())
  arr = list(map(int,input().split()))
  x = int(input())

  left = 0
  right = n-1
  count1 = count2 = 0
  sum1=sum2=0
  
  while left<=right:
   if sum1<x*sum2:
    sum1 =sum1+arr[left]
    left +=1
    count1 +=1
    
   elif sum1>x*sum2:
    sum2 =sum2+ arr[right]
    right -=1
    count2 +=1
    
   else:
    if left!=right:
     sum1 =sum1+arr[left]
     left +=1
     count1 +=1
     
    elif count1<count2:
     sum2 =sum2+ arr[right]
     right -=1
     count2 =count2+1
     
    else:
     sum1 =sum1+arr[left]
     left +=1
     count1 +=1
     
  print(count1,count2)
except:
 pass

t=int(input())
for _ in range(t):
 n=int(input())
 a=[int(y) for y in input().split()]
 x=int(input())
 ca=[0]*n
 cb=[0]*n
 psum,psumr,aeats,beats=0,0,0,0
 tie=False
 for i in range(n):
  psum=psum+a[i]
  psumr=psumr+a[n-i-1]
  if i<n-1:
   ca[i+1]=psum/x
   cb[n-i-2]=psumr
 
 for i in range(n):
  if cb[i]>ca[i]:
   aeats+=1
  elif cb[i]<ca[i]:
   beats+=1
  else:
   tie=True
 if (tie):
  if beats>aeats:
   beats+=1
  else:
   aeats+=1
 print("{} {}".format(aeats,beats))

# cook your dish here
t = int(input())
for _ in range(t):
 n = int(input())
 a = list(map(int,input().split()))
 x = int(input())
 if n==1:
  print(1,0)
  continue
 else:
  sum1 = sum(a)
  lim = x*(int((sum1/(x+1))))
  sumt = 0
  f = -1
  c1 = 0
  while lim > sumt:
   f += 1
   sumt += a[f]
   c1 += 1
  c1 = c1-1
  #print(f,c1)
  for i in range(f,n-1):
   t1 = sum(a[:i])/x
   t2 = sum(a[i+1:])
   #print(c1,i,t1,t2)
   if t1 < t2:
    c1 += 1
   elif t1==t2:
    if i >= (n-i)-1:
     c1 += 1
    break
   else:
    break
  print(c1,n-c1)

# cook your dish here
t = int(input())
for _ in range(t):
 n = int(input())
 a = list(map(int,input().split()))
 x = int(input())
 c1 = 1
 if n==1:
  print(1,0)
  continue
 else:
  for i in range(1,n-1):
   t1 = sum(a[:i])/x
   t2 = sum(a[i+1:])
   if t1 < t2:
    c1 += 1
   elif t1==t2:
    if i >= (n-i)-1:
     c1 += 1
    break
   else:
    break
  print(c1,n-c1)

for _ in range(int(input())):
 n=int(input())
 arr = list(map(int,input().split()))
 X = int(input())
 if n==1:
  print(1,0)
  continue
 l,r = 0,n-1
 a,b=0,0
 sumA,sumB=0,0
 while l<r:
  if sumA<=sumB*X:
   sumA+=arr[l]
   l+=1
   a+=1
  else:
   sumB+=arr[r]
   r-=1
   b+=1
 if l==r:
  if sumA-sumB*X==0:
   if a>=b:
    a+=1
   else:
    b+=1
  elif sumA-sumB*X<0:
   a+=1
  else:
   b+=1
 print(a,b)


for _ in range(int(input())):
 N = int(input())
 candies = list(map(int, input().split()))
 x = int(input())
 sum = 0
 for a in range(N):
  sum += candies[a]
 lftSum = candies[0]
 rgtSum = sum - lftSum
 lftans = 1
 rgtans = N - 1
 for a in range(1, N):
  if rgtSum - candies[a] == lftSum/x:
   if lftans >= rgtans - 1:
    lftans += 1
    rgtans -= 1
    break
   else:
    break
  elif rgtSum - candies[a] < lftSum/x:
   break
  else:
   lftans += 1
   rgtans -= 1
  lftSum += candies[a]
  rgtSum -= candies[a]

 print(lftans, rgtans)

for _ in range(int(input())):
 n = int(input())
 lst = list(map(int, input().split()))
 x = int(input())

 A, B = 0, 0
 i, j = 0, n - 1

 while i < j:
  B += 1
  chocsA = x * lst[j]

  while i < j and chocsA >= lst[i]:
   chocsA -= lst[i]
   i += 1
   A += 1
   
  lst[i] -= chocsA
  j -= 1

 if i == j:
  if chocsA > 0:
   A += 1

  else:
   if A >= B:
    A += 1
   else:
    B += 1

 print(A, B)
 

 


T=int(input())
for _ in range(T):
 N=int(input())
 l=list(map(int,input().split()))
 X=int(input())
 A=l[:]
 B=l[:]
 for i in range(1,N):
  A[i]=A[i-1]+A[i]
  B[N-1-i]=B[N-1-i]+B[N-i]
 #print(A,B)
 i=0
 j=N-1
 while i<j and j-i>1:
  if A[i]/X<B[j]:
   i+=1
  elif A[i]/X>B[j]:
   j-=1
  else:
   if i+1<N-j:
    j-=1
   else:
    i+=1
 print(i+1,N-j)


for _ in range(int(input())):
 n = int(input())
 arr = list(map(int, input().split()))
 x = int(input())
 left, right = 0, n-1
 c1, c2 = 0, 0
 b1, b2 = 0, 0
 while left <= right:
  if c1 < x * c2:
   # print('h1')
   c1 += arr[left]
   left += 1
   b1 += 1
  elif c1 > x * c2:
   # print('h2')
   c2 += arr[right]
   right -= 1
   b2 += 1
  else:
   if left != right:
    # print('h3')
    c1 += arr[left]
    left += 1
    b1 += 1
   else:
    if b1 < b2:
     # print('h4')
     c2 += arr[right]
     right -= 1
     b2 += 1
    else:
     # print('h5')
     c1 += arr[left]
     left += 1
     b1 += 1
 print(b1, b2)

#oimv
d=int(input())
for tt in range(d):
 n=int(input())
 s=list(map(int,input().split()))
 x=int(input())
 sum=[]
 count=0
 low=-1
 high=n
 if(n==1):
  print("1 0")
  continue
 counta=0
 countb=0
 timea=0
 timeb=0
 while(1):
  if(low>=high-1):
   break
  if timea<timeb:
   low+=1
   timea+=s[low]/x
   counta+=1
  elif timea>timeb:
   high-=1
   timeb+=s[high]
   countb+=1
  else:
   if counta>=countb:
    low+=1
    timea+=s[low]/x
    counta+=1
   else:
    high-=1
    timeb+=s[high]
    countb+=1
 print(counta,countb)

#https://www.codechef.com/problems/BIT2B
import math
import bisect
t=int(input())
while t!=0:
 t-=1
 n=int(input())
 candies=[int(x) for x in input().split()]
 rate=int(input())
 a_start_time=[0 for x in range(n)]
 b_start_time=[0 for x in range(n)]
 a_start_time[0]=0
 b_start_time[-1]=0
 sum_candies=candies[0]
 for i in range(1,n):
  a_start_time[i]=sum_candies/rate
  sum_candies+=candies[i]
 

 for i in range(n-2,-1,-1):
  b_start_time[i]=b_start_time[i+1]+candies[i+1]
 
 a_count=0
 b_count=0
 if n==1:
  print(1, 0)
  continue
 elif n==2:
  print(1, 1)
  continue
 for i in range(n):
  if(a_start_time[i]<b_start_time[i]):
   a_count+=1
  elif(b_start_time[i]==a_start_time[i]):
   if(a_count>=n-a_count-1):
    a_count+=1
 print(a_count,n-a_count)

#https://www.codechef.com/problems/BIT2B
import math
import bisect
t=int(input())
while t!=0:
 t-=1
 n=int(input())
 candies=[int(x) for x in input().split()]
 rate=int(input())
 a_start_time=[0 for x in range(n)]
 b_start_time=[0 for x in range(n)]
 a_start_time[0]=0
 b_start_time[-1]=0
 sum_candies=candies[0]
 for i in range(1,n):
  a_start_time[i]=sum_candies/rate
  sum_candies+=candies[i]
 

 for i in range(n-2,-1,-1):
  b_start_time[i]=b_start_time[i+1]+candies[i+1]
 
 a_count=0
 b_count=0
 if n==1:
  print(1, 0)
  continue
 elif n==2:
  print(1, 1)
  continue
 for i in range(n):
  if(a_start_time[i]<b_start_time[i]):
   a_count+=1
  elif(b_start_time[i]==a_start_time[i]):
   if(a_count>=n-a_count-1):
    a_count+=1
 print(a_count,n-a_count)

#https://www.codechef.com/problems/BIT2B
import math
import bisect
t=int(input())
while t!=0:
 t-=1
 n=int(input())
 candies=[int(x) for x in input().split()]
 rate=int(input())
 a_start_time=[0 for x in range(n)]
 b_start_time=[0 for x in range(n)]
 a_start_time[0]=0
 b_start_time[-1]=0
 sum_candies=candies[0]
 for i in range(1,n):
  a_start_time[i]=sum_candies//rate
  sum_candies+=candies[i]
 

 for i in range(n-2,-1,-1):
  b_start_time[i]=b_start_time[i+1]+candies[i+1]
 
 a_count=0
 b_count=0
 if n==1:
  print(1, 0)
  continue
 elif n==2:
  print(1, 1)
  continue
 for i in range(n):
  if(a_start_time[i]<b_start_time[i]):
   a_count+=1
  elif(b_start_time[i]==a_start_time[i]):
   if(a_count>=n-a_count-1):
    a_count+=1
 print(a_count,n-a_count)

#https://www.codechef.com/problems/BIT2B
import math
import bisect
t=int(input())
while t!=0:
 t-=1
 n=int(input())
 candies=[int(x) for x in input().split()]
 rate=int(input())
 a_start_time=[0 for x in range(n)]
 b_start_time=[0 for x in range(n)]
 a_start_time[0]=0
 b_start_time[-1]=0
 sum_candies=candies[0]
 for i in range(1,n):
  a_start_time[i]=sum_candies//rate
  sum_candies+=candies[i]
 

 for i in range(n-2,-1,-1):
  b_start_time[i]=b_start_time[i+1]+candies[i+1]
 
 a_count=0
 b_count=0
 if n==1:
  print(1, 0)
  continue
 elif n==2:
  print(1, 1)
  continue
 for i in range(n):
  if(a_start_time[i]<b_start_time[i]):
   a_count+=1
  elif(b_start_time[i]<a_start_time[i]):
   b_count+=1
  else:
   if(a_count<n-a_count-1):
    b_count+=1
   else:
    a_count+=1
 print(a_count,n-a_count)

import math
import bisect
t=int(input())
while t!=0:
 t-=1
 n=int(input())
 candies=[int(x) for x in input().split()]
 rate=int(input())
 leftover=0
 a_start_time=[0 for x in range(n)]
 b_start_time=[0 for x in range(n)]
 a_start_time[0]=0
 b_start_time[-1]=0
 sum_candies=candies[0]
 for i in range(1,n):
  a_start_time[i]=sum_candies//rate
  sum_candies+=candies[i]
 

 for i in range(n-2,-1,-1):
  b_start_time[i]=b_start_time[i+1]+candies[i+1]
 
 a_count=0
 b_count=0
 if n==1:
  print(1, 0)
  continue
 elif n==2:
  print(1, 1)
  continue
 for i in range(n):
  if(a_start_time[i]<b_start_time[i]):
   a_count+=1
  elif(b_start_time[i]<a_start_time[i]):
   b_count+=1
  else:
   if(a_count<n-a_count-1):
    b_count+=1
   else:
    a_count+=1
 print(a_count,n-a_count)