Combinatorics of periodic ellipsoidal billiards