def swap(state, one, the_other):
    """
    Takes a n-puzzle state and two tupples as arguments. Swaps the contents
    of one coordinate with the other. Returns the result.
    """
    x1, y1 = one[0], one[1]
    x2, y2 = the_other[0], the_other[1]
    state[x1][y1], state[x2][y2] = state[x2][y2], state[x1][y1]
    return state