N,M,K = map(int,input().split()) ans = [[(K*i+j)%M+1 for j in range(N)] for i in range(N)] for i in ans: print(*i)