def mox(x,p): z=x/p z1=int(z) return x-z1*p p=7 for x1 in range(p): for y1 in range(p): print(mox(x1+y1,p))