#include <stdio.h>
int main()
{ int a[]={1,2,3,4,5,6},h,i,j,k;
int b[15][3][2];
for(i=0;i<3;i++){b[0][i][0]=a[2*i];b[0][i][1]=a[2*i+1];} // translate a to b
for(i=1;i<5;i++)for(j=0;j<3;j++)for(k=0;k<2;k++){b[i][j][k]=b[0][j][k];} // dup 4
// generate 4 more seed arrays by swapping the last element of the first pair
for(i=1;i<5;i++){ k=b[i][0][1];
b[i][0][1]=b[i][(i+1)/2][(i+1)%2]; // the "i+1" - th element of a from b[i]
b[i][(i+1)/2][(i+1)%2]=k; // swap by k
}
for(h=1;h<3;h++)for(i=0;i<5;i++)for(j=0;j<3;j++)for(k=0;k<2;k++){b[5*h+i][j][k]=b[i][j][k];} // dup 10
// swap the the last element of the 2-nd pair ... in 2 instances
for(i=0;i<5;i++){ k=b[5+i][1][1]; j=b[10+i][1][1]; // insane
b[5+i][1][1]=b[5+i][2][0]; // no-comment , non-opt
b[10+i][1][1]=b[10+i][2][1]; // just getting it done ...
b[5+i][2][0]=k; // swap by k
b[10+i][2][1]=j; // swap by j
}
for(k=0;k<5;k++){ j=5+k; i=10+k;
printf("%d : (%d,%d)(%d,%d)(%d,%d) , ",k,b[k][0][0],b[k][0][1],b[k][1][0],b[k][1][1],b[k][2][0],b[k][2][1]);
printf("%d : (%d,%d)(%d,%d)(%d,%d) , ",k,b[j][0][0],b[j][0][1],b[j][1][0],b[j][1][1],b[j][2][0],b[j][2][1]);
printf("%d : (%d,%d)(%d,%d)(%d,%d)\n",k,b[i][0][0],b[i][0][1],b[i][1][0],b[i][1][1],b[i][2][0],b[i][2][1]);
}
printf("Done!\n");
return 0;
}