def get_offsets(direction):
    """
    Returns the relative x and y offsets of the neighbor cell in the given direction.
    """
    return {"up": (-1, 0), "down": (1, 0), "left": (0, -1), "right": (0, 1)}[direction]