class SubrectangleQueries:

    def __init__(self, rectangle: List[List[int]]):
        self.rect = rectangle
        

    def updateSubrectangle(self, row1: int, col1: int, row2: int, col2: int, newValue: int) -> None:
        if(row1>row2):
            row1=row1+row2
            row2=row1-row2
            row1=row1-row2
        if(col2>col1):
            col1+=col2
            col2=col1-col2
            col1=col1-col2
        for i in range(row1,row2+1):
            for j in range(col2,col1+1):
                self.rect[i][j]=newValue
            
        

    def getValue(self, row: int, col: int) -> int:
        return self.rect[row][col]


# Your SubrectangleQueries object will be instantiated and called as such:
# obj = SubrectangleQueries(rectangle)
# obj.updateSubrectangle(row1,col1,row2,col2,newValue)
# param_2 = obj.getValue(row,col)