from typing import List


def possible(matrix: List[List[int]], x: int, y: int, n:int) -> bool:
    """
    Based on sudoku's rules, checks if a integer n can be placed in matrix[x][y]
    without breaking the game. Return true if test pass, false otherwise
    """

    # Check for problem in row
    for i in range(0, 9):
        if matrix[x][i] == n:
            return False

    # Check for problem in column
    for j in range(0, 9):
        if matrix[j][y] == n:
            return False
    
    # Initial indexes for inner square
    x0 = (x // 3) * 3
    y0 = (y // 3) * 3

    # Check for problem in inner square
    for i in range(0, 3):
        for j in range(0, 3):
            if matrix[x0 + i][y0 + j] == n:
                return False
    
    return True