Ща проверь:
	
	
	
		
		
		
		
	
	
def solve(): 
    n = int(input()) 
    cells = [0] * n   
    actions = [] 
 
    def print_state(): 
        print(f"Cells: {cells}"
   
        print(f"Actions: {actions}"
 
 
    def place_chip(cell_index): 
        cells[cell_index] = 1 
        actions.append(cell_index + 1) 
 
 
    def remove_chip(cell_index): 
        cells[cell_index] = 0 
        actions.append(-(cell_index + 1)) 
 
 
    def find_leftmost_chip_index(): 
        for i in range

: 
            if cells
 == 1: 
                return i 
        return -1   
 
    if n == 1: 
        place_chip(0)   
    elif n == 2: 
        place_chip(0) 
        place_chip(1) 
    elif n == 3: 
        place_chip(0) 
        place_chip(1) 
        remove_chip(0) 
        place_chip(2) 
        place_chip(0)  
    elif n == 4: 
        place_chip(0) 
        place_chip(1) 
        remove_chip(0) 
        place_chip(2) 
        place_chip(0) 
        place_chip(3)  
        remove_chip(2)  
    else: 
 
        print("За отведенное количество ходов решение не найдено"
 
        return 
 
 
    if all(cells): 
        print(*actions) 
    else: 
        print("За отведенное количество ходов решение не найдено"
 
 
solve()