| t | n, m = map(int, input().split(',')) | t | n, m = map(int, input().split(',')) | 
            |  | matrix = [[0 for j in range(n)] for i in range(m)] |  | matrix = [[0 for j in range(n)] for i in range(m)] | 
            |  | left, right = (0, n - 1) |  | left, right = (0, n - 1) | 
            |  | top, bottom = (0, m - 1) |  | top, bottom = (0, m - 1) | 
            |  | now = 0 |  | now = 0 | 
            |  | while left <= right and top <= bottom: |  | while left <= right and top <= bottom: | 
            |  | for i in range(left, right + 1): |  | for i in range(left, right + 1): | 
            |  | matrix[top][i] = now |  | matrix[top][i] = now | 
            |  | now += 1 |  | now += 1 | 
            |  | if now == 10: |  | if now == 10: | 
            |  | now = 0 |  | now = 0 | 
            |  | top += 1 |  | top += 1 | 
            |  | for i in range(top, bottom + 1): |  | for i in range(top, bottom + 1): | 
            |  | matrix[i][right] = now |  | matrix[i][right] = now | 
            |  | now += 1 |  | now += 1 | 
            |  | if now == 10: |  | if now == 10: | 
            |  | now = 0 |  | now = 0 | 
            |  | right -= 1 |  | right -= 1 | 
            |  | if top <= bottom: |  | if top <= bottom: | 
            |  | for i in range(right, left - 1, -1): |  | for i in range(right, left - 1, -1): | 
            |  | matrix[bottom][i] = now |  | matrix[bottom][i] = now | 
            |  | now += 1 |  | now += 1 | 
            |  | if now == 10: |  | if now == 10: | 
            |  | now = 0 |  | now = 0 | 
            |  | bottom -= 1 |  | bottom -= 1 | 
            |  | if left <= right: |  | if left <= right: | 
            |  | for i in range(bottom, top - 1, -1): |  | for i in range(bottom, top - 1, -1): | 
            |  | matrix[i][left] = now |  | matrix[i][left] = now | 
            |  | now += 1 |  | now += 1 | 
            |  | if now == 10: |  | if now == 10: | 
            |  | now = 0 |  | now = 0 | 
            |  | left += 1 |  | left += 1 | 
            |  | for i in matrix: |  | for i in matrix: | 
            |  | print(' '.join(map(str, i))) |  | print(' '.join(map(str, i))) |