Solving The Sports League Scheduling Problem With
Solving The Sports League Scheduling Problem With
net/publication/221204639
CITATIONS READS
41 2,255
2 authors, including:
Jin-Kao Hao
University of Angers
493 PUBLICATIONS 11,870 CITATIONS
SEE PROFILE
All content following this page was uploaded by Jin-Kao Hao on 20 May 2014.
1 2
Jean-Philippe Hamiez and Jin-Kao Hao
1
LGI2P / Ecole des Mines d'Alès – EERIE
Parc Scientifique Georges Besse – 30035 Nîmes Cedex 01 (France)
[email protected]
2
LERIA / Université d’Angers – 2, Bd. Lavoisier – 49045 Angers Cedex 01 (France)
[email protected]
Abstract. In this paper we present a tabu approach for a version of the Sports
League Scheduling Problem. The approach adopted is based on a formulation
of the problem as a Constraint Satisfaction Problem (CSP). Tests were carried
out on problem instances of up to 40 teams representing 780 integer variables
with 780 values per variable. Experimental results show that this approach
outperforms some existing methods and is one of the most promising methods
for solving problems of this type.
1 Introduction
Many sports leagues (e.g. soccer, hockey, basketball) must deal with scheduling
problems for tournaments. These scheduling problems contain in general many
conflicting constraints to satisfy and different objectives to optimize, like
minimization of traveling distance [2], only one match per team and per day,
stadium unavailability at particular dates, minimum number of days between a home
match and its corresponding away match, etc. Generating satisfactory schedules
with respect to these conditions and objectives is therefore a very difficult problem
to solve.
Many studies have been carried out to try to solve these problems with a variety
of approaches and varying degrees of success: integer linear programming [7][12],
constraint programming [10][17], local search (simulated annealing [19], tabu
search [23], hybrid approach [4]).
This paper deals with a specific Sports League Scheduling Problem (SLSP)
described by K. McAloon, C. Tretkoff and G. Wetzel in [11]. After having obtained
poor results in integer linear programming tests, they experimented with constraint
programming, an approach that produced better results. Finally, with a basic local
search algorithm, they produced the same results as ILOG Solver does, but with less
computing time.
C.P. Gomes, B. Selman and H.A. Kautz [9] obtained better results than those of
McAloon et al. using constraint programming. With a randomized version of a
deterministic complete search they solved problems involving a greater number of
teams.
J.C. Régin proposed two approaches with constraint programming for the SLSP
[15][16]. The first one, using powerful filtering algorithms [3][13][14], produced
better results than those of McAloon et al. and those of Gomes et al. in terms of
execution time and robustness, since it solved problem instances of a larger size.
Using a second approach, he transformed the SLSP into an equivalent problem by
adding an implicit constraint. With a new heuristic and specific filtering algorithms,
he improved on his own results.
Finally, let us mention the work done by G. Wetzel and F. Zabatta [22]: using
multiple threads on a 14 processor Sun system they obtained better results than the
first approach of Régin. They were, however, not able to solve problems as large as
those which Régin solved with his second approach.
The goal of this study is to propose an advanced local search approach based on
tabu search (TS) [8] for the SLSP. References of the study are results presented in
[11], [15] and [16].
The paper begins by formally describing the SLSP (§2). After modeling the
problem as a constraint satisfaction problem (CSP) [20] (§3), we present our tabu
algorithm (§4) and compare its results with those of [11], [15] and [16] (§5). Before
concluding, we discuss some observations made during this work (§6).
2 Problem Description
In the rest of the paper, we will deal with the following constraints and definitions,
the same as in [11]:
• There are |T| teams (|T| even), where T is the set of all teams. All teams play each
other exactly once (half competition);
• The season lasts |T| - 1 weeks;
• Every team plays one game in every week of the season;
• There are |T| / 2 periods and, each week, one game is scheduled in every period;
• No team plays more than twice in the same period over the course of the season.
The problem then is to schedule the tournament with respect to all these
constraints.
Table 1 below shows an example of a valid schedule for |T| = 8 teams labeled
from 1 to 8; there are 7 weeks and 4 periods.
Weeks
1 2 3 4 5 6 7
1 1 vs 2 1 vs 3 5 vs 8 4 vs 7 4 vs 8 2 vs 6 3 vs 5
Periods
2 3 vs 4 2 vs 8 1 vs 4 6 vs 8 2 vs 5 1 vs 7 6 vs 7
3 5 vs 6 4 vs 6 2 vs 7 1 vs 5 3 vs 7 3 vs 8 1 vs 8
4 7 vs 8 5 vs 7 3 vs 6 2 vs 3 1 vs 6 4 vs 5 2 vs 4
As shown in Table 1, a configuration may be represented as a two-dimensional
array with weeks in columns and periods in rows. Each column satisfies the
cardinality constraint: each team appears exactly once, i.e. all the teams are
different. In each row, no team appears more than twice. There is also a global
constraint on the array: each match only appears once, i.e. all matches are different.
3 Problem Formulation
and m ≠ q;
• No more than two matches for each team in the same period. For each team tn,
tn ∈ T, 1 ≤ n ≤ |T| and each period, we impose the constraint:
PERIOD(tn) ⇔ |{pm, n = pq, n, (m, q) ∈ [1; |T|] , m ≠ n, q ≠ n et m ≠ q}| ≤ 1;
2
• All matches are different. For each match < tm, tn >, (tm, tn) ∈ T², tm ≠ tn, we
impose the constraint: ALLDIFF(< tm, tn >) ⇔ < tm, tn > ≠ < tq, tr >, ∀ (tq, tr) ∈ T²,
t q ≠ t r.
The WEEK and ALLDIFF constraints are always satisfied in our algorithm.
Tabu search is an advanced local search method using general mechanisms and rules
as guidelines for smart search. Readers may find formal description of the method
in [8]. We now define the components of our tabu algorithm for the SLSP, called
TS-SLSP.
4.3 Neighborhood
Let s be a configuration from the search space S. The neighborhood N: S → 2 is an
s
application such as for each s ∈ S, s' ∈ N(s) if and only if s and s' only differ by
values of a single couple of variables, with at least one in conflict (a variable is said
to be conflicting if it is involved in an unsatisfied constraint).
A neighboring configuration of s can be obtained by making a single swap of
current values of two arbitrary variables, with at least one conflicting in s. A move
from configuration s to a neighboring configuration s' can then be described by a
couple < x(tm, tn), x(tq, tr) > i.e. swapping two matches (see Fig. 2). In addition, swaps
are made in the same week to keep the WEEK constraint satisfied.
During the search the neighborhood size always evolves with the number of
conflicts.
Weeks Weeks
1 2 3 4 5 1 2 3 4 5
1,2 2,6 3,4 5,6 2,4 1 1 1,2 2,6 3,4 5,6 1,5
Periods
4,6 1,3 2,5 1,4 3,6 2 2 4,6 1,3 2,5 1,4 3,6
3,5 4,5 1,6 2,3 1,5 3 3 3,5 4,5 1,6 2,3 2,4
Configuration s Configuration s'
Fig. 2. Neighborhood illustration (6 teams)
4.4 Evaluation Function
To compare, in terms of quality, two configurations s and s’ from S, we define an
evaluation function which is an order relation for S.
Let OccPS(p, tn) be the occurrence number of team tn, in period p, in configuration
s. The evaluation function f(s) is the total number of excess appearances of all teams
in all periods (let us call it fP(s)) i.e. the minimum number of variables to be changed
to satisfy the PERIOD constraint:
P T
f(S) = fp(S) = ∑ ∑ P
(s, n, p),
p = 1n = 1 (1)
0 if OccPS (p, t n ) ≤ 2,
(s, n, p) =
P î OccPS (p, t n ) − 2 otherwise .
5 Computational Results
In this section, we compare results of our TS algorithm with those of [11], [15]
and [16]. Our tests were carried out on a Sun Sparc Ultra 1 (256 RAM, 143 MHz).
TS-SLSP1 is implemented in C (CC compiler with -O5 option). Tests were carried
out on problem instances including 6 to 40 teams (only those greater than 14 are
shown). The TS-SLSP algorithm was allowed to run until a maximum number of 10
million iterations.
1
For the source code of TS-SLSP, contact the authors.
5.2 Comparative Results
McAloon et al. [11] recall that Integer Linear Programming (ILP) with CPLEX [5]
was not able to solve the SLSP for |T| = 14 teams, even when avoiding symmetries.
Nevertheless, the method is able to provide solutions for |T| ≤ 12. They also propose
a constraint programming algorithm, implemented under ILOG Solver, which
solved the |T| = 14 problem in 45 minutes (Ultra Sparc), and was the first result
obtained with constraint programming. However, their Constraint Logic
Programming approach failed for |T| = 14. Finally, with a basic local search
algorithm, they solved the |T| = 14 problem in 10 minutes.
Gomes et al. [9] used constraint programming to solve the SLSP up to 18 teams
(in more than 48 hours) with a deterministic complete search. By including
randomness in their algorithm, they reached the same result more quickly:
approximately 22 hours for 18 teams.
In 1998, Régin presented improved results with a more elaborate approach based
on constraint propagation [15] (let us call the approach CP1). This approach
integrates advanced techniques including symmetries elimination and new powerful
filtering algorithms based on arc consistency [3][13][14]. CP1 solves much larger
problem instances since it is able to produce valid schedules for |T| = 24 in 12 hours.
In yet another study, by using multiple threads on a 14 processor Sun system,
Wetzel and Zabatta [22] obtain better results, since schedules were generated for 26
and 28 teams.
Recently, Régin proposed another improved approach [16] (let us call it CP2)
integrating among others, a heuristic based on Euler's theorem for Latin squares.
The SLSP is also transformed into an equivalent problem by adding a dummy week
in order to quickly deduce some inconsistencies. This later approach gives the best-
known results for the SLSP, since it produces solutions for 40 teams in 6 hours.
Table 2. Comparative results of TS-SLSP and well-known methods. A “-“ sign means no
result is available
CP1 CP2 TS-SLSP
Success
|T| Time Backtracks Time (s) Backtracks Time Moves
Ratio (%)
16 4.2 s 1 112 0.6 182 100 0.5 s 4 313
18 36 s 8 756 0.9 263 100 0.3 s 2 711
20 < 6 min 72 095 1.2 226 100 23.9 s 149 356
22 10 h 6 172 672 1.2 157 100 34.3 s 163 717
24 12 h 6 391 470 10.5 2 702 90 5 min 1 205 171
26 - - 26.4 5 683 50 10.7 min 2 219 711
28 - - 316 32 324 50 12.5 min 2 043 353
30 - - 138 11 895 10 22 min 3 034 073
32 - - - - 10 49 min 6 387 470
34 - - - - 30 25 min 2 917 279
36 - - - - 10 1.5 h 9 307 524
40 - - 6h 2 834 754 10 54.3 s 68 746
Table 2 shows the results of TS-SLSP together with those of CP1 and CP2.
Columns 2-5 give respectively, for CP1 and CP2, execution times and numbers of
backtracks. The last three columns give respectively the success ratio (number of
successful runs / total number of runs), mean times and average numbers of moves
for successful runs of TS-SLSP.
From the Table 2, we may make several remarks. First, we observe that TS-SLSP
is much more powerful than CP1 both in terms of the size of problem instances
solved and computing efforts. Compared with CP2, TS-SLSP also manages to find
valid schedules for problem instances going up to 40 teams. We notice however that
the resolution becomes much more difficult for |T| > 28. We notice also that the
running time of the TS-SLSP algorithm for |T| = 40 is not consistent with other
results. This is simply explained by the stochastic nature of the TS-SLSP algorithm.
Globally, the results of TS-SLSP are consistent and its running times remain
reasonable.
6 Discussions
W T
f W (S) = ∑ ∑ W
(s, n, w),
w = 1n = 1 (2)
0 if OccWS (w, t n ) ≤ 1,
(s, n, w) =
W î OccWS (w, t n ) − 1 otherwise .
2
It seems that the best weight values are 1 for PERIOD and 2 for WEEK.
3
OccWS(w, tn) is the occurrence number of team tn on week w in configuration s.
The neighborhood is extended to all possible exchanges of matches (with at least
one in conflict) in the same week or in the same period or in different periods and
weeks, see Fig. 4.
The tabu tenure is weighted and dynamic: k ’S = α * [fW(s) + fP(s)] + rand(g),
α ∈ [0.1; 1]. Intensification and diversification processes are used in the same way
as in TS-SLSP.
Weeks
1 2 3 4 5 6 7
1 1 vs 3 1 vs 2 5 vs 8 1 vs 5 4 vs 8 2 vs 6 3 vs 5
Periods
2 3 vs 4 2 vs 8 1 vs 4 6 vs 8 2 vs 5 1 vs 7 6 vs 7
3 5 vs 6 4 vs 6 2 vs 7 4 vs 7 3 vs 7 3 vs 8 1 vs 8
4 7 vs 8 5 vs 7 3 vs 6 2 vs 3 1 vs 6 4 vs 5 2 vs 4
Fig. 4. Extended neighborhood illustration
7 Conclusion
In this paper we presented a tabu algorithm (TS-SLSP) for the sports league
scheduling problem. The algorithm is based on a CSP formulation of the SLSP and
includes the following main features:
• a simple swap neighborhood;
• efficient data structures for fast neighborhood search;
• a dynamic tabu tenure;
• a simple intensification-diversification process.
TS-SLSP was tested on problem instances going up to 40 teams. The
experimental results show that TS-SLSP largely outperforms some previously
developed approaches (ILP [11], basic LS [11] and constraint programming [9][15]).
Indeed, while these approaches are limited to instances of 24 teams, TS-SLSP is
able to find a schedule for instances going up to 40 teams. This result compares well
with the best-known approach, which combines well-elaborated constraint
propagation algorithms and a non-trivial formulation of the initial problem [16].
At the same time, the computing times required by TS-SLSP are much greater
than those obtained using the most efficient algorithm. Nevertheless, there is
certainly plenty of room for improvement in TS-SLSP. One possible enhancement
would be to integrate more elaborate intensification and diversification mechanisms,
another would be to have a close study of configuration structures in order to devise
clever neighborhoods and constraint handling techniques. It would also be
interesting to envisage a combination of some advanced constraint propagation
techniques with tabu search.
This work underlines once again the importance of efficient data structures for
the high performance of a TS algorithm. It also confirms that parameter setting is
crucial for obtaining quality solutions.
The TS-SLSP may also be adaptable to other sports scheduling problems e.g. the
minimization of breaks (two consecutive home or away matches) [21] and those
studied in [17]. Let us also mention that TS has already proven efficient for solving
some sports scheduling problems, with constraints of various types. A hybrid tabu
search has been proposed [4] to respond to the National Hockey League’s
scheduling problem, which underlines the effectiveness of a TS / genetic algorithm
combination; the skilful mix of elements of the two methods produces better results
than those of separately considered methods. All these studies suggest that a
metaheuristic approach (e.g. TS, simulated annealing, genetic hybrid) has good
potential for solving various planning and scheduling problems related to sporting
events.4
Acknowledgments
We would like to thank J.C. Régin for having sent us his latest results and the
referees for their relevant remarks.
References
1. Ackley, D.H.: A Connectionist Machine for Genetic Hillclimbing. Boston, MA: Kluwer
Academic Publishers (1987)
2. Bean, J.C., Birge, J.R.: Reducing Travelling Costs and Player Fatigue in the National
Basketball Association. Interfaces 10 / 3 (1980) 98–102
3. Bessière, C., Régin, J.C.: Arc Consistency for General Constraint Networks: Preliminary
Results. In: Proceedings of the Fifteenth International Joint Conference on Artificial
Intelligence. Nagoya, Aichi, Japan: International Joint Conference on Artificial
Intelligence, Inc. (1997) 398–404
4. Costa, D.: An Evolutionary Tabu Search Algorithm and the NHL Scheduling Problem.
INFOR 33 / 3 (1995) 161–178
5. CPLEX Optimization: Using the CPLEX©Callable Library. Tahoe, NV, Inc. (1995)
6. Ferland J.A., Fleurent, C.: Genetic and Hybrid Algorithms for Graph Coloring. Annals of
Operations Research: Metaheuristics in Combinatorial Optimization 63 / 1. Hammer,
P.L. et al. (Eds) (1996) 437–461
7. Ferland J.A., Fleurent, C.: Allocating Games for the NHL Using Integer Programming.
Operations Research 41 / 4 (1993) 649–654
8. Glover, F., Laguna, M.: Tabu Search. Boston, MA: Kluwer Academic Publishers (1997)
4
Additional studies are reported in [4][19][23].
9. Gomes C.P., Selman B., Kautz H.A.: Boosting Combinatorial Search Through
Randomization. In: Proceedings of the Fifteenth National Conference on Artificial
Intelligence. AAAI Press / The MIT Press, Madison, WI (1998) 431–437
10. Henz, M.: Scheduling a Major College Basketball Conference – Revisited. To appear in:
Operations Research 49 / 1 (2001)
11. McAloon, K., Tretkoff, C., Wetzel, G.: Sports League Scheduling. In: Proceedings of the
Third ILOG Optimization Suite International Users’ Conference. Paris, France (1997)
12. Nemhauser, G.L., Trick, M.A.: Scheduling a Major College Basketball Conference.
Operations Research 46 / 1 (1998) 1–8
13. Régin, J.C.: A Filtering Algorithm for Constraints of Difference in CSPs. In:
Proceedings of the Twelfth National Conference on Artificial Intelligence, Vol. 1.
Seattle, Washington: AAAI Press (1994) 362–367
14. Régin, J.C.: Generalized Arc Consistency for Global Cardinality Constraint. In:
Proceedings of the Thirteenth National Conference on Artificial Intelligence / Eighth
Conference on Innovative Applications of Artificial Intelligence, Vol. 1. Portland,
Oregon: AAAI Press (1996) 209–215
15. Régin, J.C.: Modeling and Solving Sports League Scheduling with Constraint
Programming. First Congress of the French Operational Research Society (ROADEF).
Paris, France (1998)
16. Régin, J.C.: Sports Scheduling and Constraint Programming. INFORMS. Cincinnati,
Ohio (1999)
17. Schaerf, A.: Scheduling Sport Tournaments Using Constraint Logic Programming.
Constraints 4 / 1 (1999) 43–65
18. Schreuder, J.A.M.: Constructing Timetables for Sport Competitions. Mathematical
Programming Study 13 (1980) 58–67
19. Terril, B.J., Willis, R.J.: Scheduling the Australian State Cricket Season Using Simulated
Annealing. Journal of the Operational Research Society 45 / 3 (1994) 276–280
20. Tsang, E.P.K.: Foundations of Constraint Satisfaction. London and San Diego: Academic
Press (1993)
21. Werra (de), D.: Geography, Games and Graphs. Discrete Applied Mathematics 2 (1980)
327–337
22. Wetzel G., Zabatta F.: CUNY Graduate Center CS Technical Report (1998)
23. Wright, M.: Timetabling County Cricket Fixtures Using a Form of Tabu Search. Journal
of the Operational Research Society 45 / 7 (1994) 758–770
Appendix:
The table in the next page gives a solution to the Sports League Scheduling Problem
found by TS-SLSP for 40 teams.
Weeks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
1 21 32 3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
11
11
12
32
40
27
39
14
15
15
16
16
17
17
18
18
19
19 20 21
20 21 22
22
23
23
24
24
25
25
26
1
13
27
28
28
29
29
30
30
31
12
40
32
33
33
34
34
35
35
36
36
37
37
38
38
39
14
26
3 1
2 39 2 3 19 5 6 22 8 9 10 11 12 13 14 15 7 38 18 10 20 21 22 23 24 25 26 27 4 29 30 7 32 33 34 17 36 1 2
4 5 6 31 8 9 34 11 12 13 14 15 16 17 18 28 40 21 31 23 24 25 26 27 28 29 30 16 32 33 19 35 36 37 40 39 37 38
8 5
3 34 10 11 3 4 23 6 7 4 9 2 7 12 13 14 15 16 13 1 19 16 21 22 15 24 25 22 27 28 25 30 10 2 33 34 5 6 3
39 36 37 8 9 31 11 12 17 14 23 20 17 18 19 20 21 26 40 24 29 26 27 36 29 30 35 32 33 38 35 18 28 38 39 31 32 37
5 6
4 37 7 1 25 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 9 26 27 28 29 30 31 32 1 2 3 4
38 39 8 40 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 40 33 34 35 36 37 38 39 33 34 35 36
9 7
5 33 8 9 1 2 3 4 5 6 7 8 30 10 11 12 13 14 15 16 17 18 19 20 6 22 23 24 25 26 27 28 29 30 1 2 18 4 5
37 38 39 10 11 12 13 14 15 16 17 36 19 20 21 22 23 24 25 26 27 28 29 40 31 32 33 34 35 36 37 38 39 31 32 40 34 35
7 8
6 35 9 10 11 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 17 18 19 20 21 22 23 24 25 26 27 28 1 16 3 4 5 6
36 37 38 39 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 40 28 29 30 31 32 33 34 35 36 37 38 39 29 40 31 32 33 34
4 9
7 38 1 2 12 13 27 2 3 8 5 6 11 8 9 10 11 12 17 14 15 20 17 18 19 20 21 26 23 24 29 26 14 32 3 4 1 10 7
35 6 7 38 39 40 15 16 13 18 19 16 21 22 23 24 25 22 27 28 25 30 31 32 33 34 31 36 37 34 39 40 37 29 30 35 28 33
18 10
8 24 11 12 13 14 24 1 2 30 4 5 33 7 8 33 10 11 12 13 14 6 16 17 3 19 20 21 22 23 9 1 2 3 4 5 15 7 8
34 35 36 37 38 30 16 17 40 19 20 40 22 23 39 25 26 27 28 29 39 31 32 9 34 35 36 37 38 15 25 26 27 28 29 21 31 32
10 11
9 32 12 17 14 26 16 21 1 23 3 25 5 2 7 36 9 6 11 12 13 10 15 16 17 14 1 20 21 4 5 2 3 8 9 6 7 8 13
33 34 31 36 40 38 35 18 37 20 39 22 27 24 40 26 31 28 29 30 35 32 33 34 39 15 37 38 18 19 24 25 22 23 28 29 30 27
11 12 13 14 15 16 17 18 19 1 2 3 4 34 6 7 8 9 10 11 12 13 14 5 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10
Periods
10 31 32 33 34 35 36 37 38 39 20 21 22 23 40 25 26 27 28 29 30 31 32 33 40 35 36 37 38 39 21 22 23 24 25 26 27 28 29 30
12 13
11 30 14 15 16 17 18 28 20 21 1 10 3 4 5 6 4 8 9 19 11 12 10 14 23 16 17 18 1 2 3 13 5 6 7 8 9 2 11
31 32 33 34 35 36 40 38 39 22 15 24 25 26 27 31 29 30 22 32 33 37 35 28 37 38 39 19 20 21 40 23 24 25 26 27 36 29
13 14
12 29 15 16 17 18 19 20 21 22 31 1 2 3 4 5 6 7 39 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12
30 31 32 33 34 35 36 37 38 40 24 25 26 27 28 29 30 40 32 33 34 35 36 37 38 39 17 18 19 20 21 22 23 24 25 26 27 28
14 15
13 28 16 13 18 19 20 17 22 2 24 4 1 6 3 4 5 10 7 8 9 14 11 12 13 18 8 2 3 22 1 6 7 15 5 10 11 12 9
29 30 35 32 33 34 39 36 19 38 21 26 23 28 29 30 27 32 33 34 31 36 37 38 35 40 16 17 39 23 20 21 40 27 24 25 26 31
15 22
14 27 17 18 4 20 21 19 23 24 25 26 13 1 2 3 16 5 6 7 8 9 4 11 12 26 2 3 28 5 6 31 8 9 10 11 12 13 1
40 29 30 7 32 33 37 35 36 37 38 14 28 29 30 19 32 33 34 35 36 40 38 39 27 14 15 31 17 18 34 20 21 22 23 24 25 39
16 17
15 26 18 24 20 21 22 23 24 25 26 27 28 29 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 11 12 13 19 15
27 28 40 30 31 32 33 24 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 11 12 13 14 15 16 17 18 19 20 21 22 23 40 25
17 18
16 25 19 20 21 22 5 24 25 26 27 28 29 30 31 1 2 3 4 18 6 3 8 1 2 7 4 5 6 7 8 9 31 11 12 13 14 15 16
26 27 28 29 30 10 32 33 34 35 36 37 38 39 32 33 34 35 23 37 40 39 9 10 40 12 13 14 15 16 17 36 19 20 21 22 23 24
6 19
17 36 23 21 22 23 15 25 26 27 28 29 9 31 32 9 1 2 3 4 5 15 1 2 21 4 5 6 7 8 24 10 11 12 13 14 3 16 20
25 40 27 28 29 39 31 32 33 34 35 18 37 38 24 34 35 36 37 38 30 7 8 30 10 11 12 13 14 39 16 17 18 19 20 33 22 40
19 20
18 23 21 22 23 24 25 26 27 28 29 30 31 32 35 34 37 1 2 3 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
24 25 26 27 28 29 30 31 32 33 34 35 36 40 38 40 36 37 38 39 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
20 21
19 22 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 1 2 1 2 3 4 5 6 7 8 10 11 11 12 13 14 15 16 17 18 19
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 38 39 3 4 5 6 7 8 9 10 40 40 13 14 15 16 17 18 19 20 21
21 16
20 41 20 19 2 15 1 7 29 3 23 12 6 5 33 8 35 17 8 5 16 7 13 15 18 3 19 25 9 10 31 4 1 4 2 35 6 14 17
28 26 29 9 37 14 10 40 18 39 13 21 24 37 25 39 20 31 36 27 38 34 34 33 11 36 32 11 12 32 22 27 26 30 38 30 24 23