($n,$m,$k)=glob<>; for$y(1..$n){ print"@{[map+($y*$k+$_)%$m+1,1..$n]}\n"; }