main(w,y,b,q){for(int f=0;f<5;f++){scanf("%d %d",&w,&y);for(b=0;b<w;b++){for(q=0;q<y;q++)printf("d f%d/du u%d%s",b,q,q<y-1?", ":"");printf("\n");}printf("\n");}}
1 1 2 1 2 2 1 2 3 3
d f0/du u0 d f0/du u0 d f1/du u0 d f0/du u0, d f0/du u1 d f1/du u0, d f1/du u1 d f0/du u0, d f0/du u1 d f0/du u0, d f0/du u1, d f0/du u2 d f1/du u0, d f1/du u1, d f1/du u2 d f2/du u0, d f2/du u1, d f2/du u2
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!