def pos_to_col_row(pos, m):
    """
    Given position and m (number of columns) returns the corresponding
    col, row on the chess board
    """
    row = pos / m
    col = pos % m
    return col, row