Satisfiability Problem · SAT solvers

Lesson 11

Nikolai Chukhin · Alexander S. Kulikov

Programming problem. You are given the first row of a Greco-Latin square. Fill in the remaining cells.

  • Input format.  The first line contains an integer \(n=7\). Each of the following \(n\) lines contains a pair of numbers from the first row.

  • Output format.  Output a filled square following the format below.

5 points
Public samples
Public sample 1
Input
7
1 2
7 4
3 1
2 3
6 5
5 7
4 6
Expected output
1,2 7,4 3,1 2,3 6,5 5,7 4,6
3,7 2,6 5,3 6,2 1,1 4,4 7,5
7,1 6,7 2,5 3,6 4,2 1,3 5,4
4,3 1,5 6,4 5,1 2,7 7,6 3,2
5,5 4,1 1,6 7,7 3,4 2,2 6,3
2,4 3,3 7,2 4,5 5,6 6,1 1,7
6,6 5,2 4,7 1,4 7,3 3,5 2,1