def METHOD_NAME(atom, array, stack):
    new_atom = atom
    new_atom.chain_id = "C"
    del array[2]
    assert array.chain_id.tolist() == ["A","A","B","B"]
    array[-1] = new_atom
    assert array.chain_id.tolist() == ["A","A","B","C"]
    del stack[1]
    assert stack.stack_depth() == 2