Latin square implementation in C++.