Python Exponential Game Confusion

hey guys
im new here, and i cant figure out whats wrong with this code
its in python, and seems correct
thanks in advance

cases=int(input(""))
output=[]
for i in range(1, cases+1):
n=int(input(""))
x=input("")
b=x.split()
piles=[]
for i in range(0, n):
piles.append(int(b[i]))

current=1
for i in range(0, n):
    while(piles[i]>0):
        
        if piles[i]>823543:
            piles[i]=piles[i]-823543
        
        elif piles[i]>=46656:
            piles[i]=piles[i]-46656
        elif piles[i]>=3125:
            piles[i]=piles[i]-3125
        elif piles[i]>=256:
            piles[i]=piles[i]-256
        elif piles[i]>=27:
                piles[i]=piles[i]-27
        elif piles[i]>=4:
                piles[i]=piles[i]-4
        else:
                piles[i]=piles[i]-1
                
        if current==1:
                current=0
        else:
                current=1
if current==0:
    output.append("Little Chef")
else:
    output.append("Head Chef")

for i in output:
print (i)