Abstract : We consider the pure supersymmetric Yang--Mills theories placed on a small 3-dimensional spatial torus with higher orthogonal and exceptional gauge groups. The problem of constructing the quantum vacuum states is reduced to a pure mathematical problem of classifying the flat connections on 3-torus. The latter problem is equivalent to the problem of classification of commuting triples of elements in a connected simply connected compact Lie group which is solved in this paper. In particular, we show that for higher orthogonal SO(N), N > 6, and for all exceptional groups the moduli space of flat connections involves several distinct connected components. The total number of vacuumstates is given in all cases by the dual Coxeter number of the group which agrees with the result obtained earlier with the instanton technique.