N=1<>(i%4*4+j%4))%2+(j-j%4+(3830337252>>(i%4*8+j%4*2))%4)*2][i//4==j//4]+N*(i-i%2)for j in R]for i in R],[[-1]]][N<3]:print(*m)