from itertools import product as p;L=raw_input();print '\n'.join(' '.join(map(str,i))for i in p(range(1,int(L[0])+1),repeat=int(L[2])))