n=int(input("Enter the number of capacitor used:"))
c_row=list()
v_row=list()
v_safe_row=list()
v_safe_col=list()
for i in range(1,n+1):
  m=int(input("Enter the number of capacitor in breakdown voltage"))
  v_row.clear()
  c_sum=0
  c_p=1
  for j in range(1,m+1):
    c_row.append(int(input("Enter the value of capacitor")))
    v_row.append(int(input("Enter the value of breakdown\voltage")))
    c_sum+=c_row[j-1]
    c_p*=c_row[j-1]
  if m==1:
    v_safe_col.append(v_row[0])
  else:
    for k in range(1,m+1):
      v_safe_row.append(v_row[k-1]*c_sum*c_row[k-1]/c_p)
      v_safe_col.append(min(v_safe_row))
  print("Maximum safe voltage for given capacitor \configuration is",min(v_safe_col),'V')