You are given two positive integers, n and d.
Create a square table of size n×n containing only integers between 0 and d-1, inclusive, such that each row and each column contains each number between 0 and d-1, inclusive, at least once.
Return this table as a String containing exactly n elements. Each element represents a single row of the table and contains a single space delimited list of the numbers in that row from left to right. The numbers must have no extra leading zeroes.
If there are multiple possible answers, return the one with the lexicographically smallest first element. If there is still a tie, return the one with the lexicographically smallest second element, etc.