import copy


def step_order(step_dict):
    """
    Given data about what steps can be done in what order, determine the order (alphabetical breaks ties) in which
    steps must be done.
    :param step_dict: the step data as generated by create_step_dict
    :return: the order in which to do the steps, as a string

    >>> step_order({'A': ['C'], 'F': ['C'], 'B': ['A'], 'D': ['A'], 'E': ['B', 'D', 'F']})
    'CABDFE'
    """
    step_dictp = copy.deepcopy(step_dict)

    # Get the set of all steps.
    steps = set()
    for values in step_dictp.values():
        steps.update(values)
    for keys in step_dictp.keys():
        steps.update(keys)

    # While there are steps left, determine what will be done.
    step_order_list = []
    while len(steps) > 0:
        # Symmetric difference between the keys and the steps are what can be done.
        candidates = sorted(list(steps.difference(step_dictp.keys())))
        next_step = candidates.pop(0)
        steps.remove(next_step)
        step_order_list.append(next_step)
        if next_step in step_dictp.keys():
            del step_dictp[next_step]

        keys = list(step_dictp.keys())
        for k in keys:
            if next_step in step_dictp[k]:
                step_dictp[k].remove(next_step)
                if len(step_dictp[k]) == 0:
                    del step_dictp[k]

    return ''.join(step_order_list)