Can anyone please help me to figure out my fault?? Its give WA for which test case(s)??

```
import sys
def main():
# sys.stdin = open('in.txt', 'r')
# sys.stdout = open('out.txt', 'w')
t = int(sys.stdin.readline())
for _ in range(t):
n = int(sys.stdin.readline())
c = list(map(int, sys.stdin.readline().split()))
x = int(sys.stdin.readline())
if n == 1:
print(1, 0)
continue
e1, e2, b1, b2, i = c[0], c[n - 1], 1, 1, 1
while b1 + b2 < n:
if e1 < x * e2:
e1 += c[i]
b1 += 1
i += 1
elif e1 > x * e2:
b2 += 1
e2 += c[n - b2]
else: #e1 == x * e2:
if b1 >= b2:
e1 += c[i]
i += 1
b1 += 1
else: #b1 < b2:
b2 += 1
e2 += c[n - b2]
print(b1, b2)
if __name__ == "__main__":
main()
```

**EDIT :**

Solution link [WA]

[N.B.: Some portion of this code changed (but not logically) for clarification.]