latin squares and their applications