def iterate_neighbors(pos):
    """
    Iterate through all the single-axis neighbors of a
    coordinate tuple.

    Order is deterministic.
    """
    for axis, val in enumerate(pos):
        for offset in [-1, 1]:
            yield pos[:axis] + (val + offset,) + pos[axis + 1:]
