Generalized latin square