classSolution:"""
def check(ch):
s = ch * length
any(row == s for row in board) # 行
any(col == s for col in map(''.join, zip(*board))) # 列
all(board[i][i] for i in range(length)) # -45度对角线
all(board[i][length-i-1] for i in range(length)) # 45度对角线
"""deftictactoe(self, board: List[str])->str:
n =len(board)defcheck(ch):
s = ch * n
returnany((any(row == s for row in board),any(col == s for col inmap(''.join,zip(*board))),all(board[i][i]== ch for i inrange(n)),all(board[i][n - i -1]== ch for i inrange(n)),))if check('X'):return'X'if check('O'):return'O'if' 'in''.join(board):return'Pending'return'Draw'