| I I U C O N L I N E C O N T E S T 2 0 0 8 | |
| Problem C: The 3-Regular Graph | |
| Input: standard input Output: standard output | |
| 
 | |
| The degree of a vertex in a graph is the number of edges adjacent to the vertex. A graph is 3-regular if all of its vertices have degree 3. Given an integer n, you are to build a simple undirected 3-regular graph with n vertices. If there are multiple solutions, any one will do. 
 | |
| Input | |
| For each test case, the input will be a single integer n as described above. End of input will be denoted by a case where n = 0. This case should not be processed. 
 | |
| Output | |
| If it is possible to build a simple undirected 3-regular graph with n vertices, print a line with an integer e which is the number of edges in your graph. Each of the following e lines describes an edge of the graph. An edge description contains two integers a & b, the two endpoints of the edge. Note that the vertices are indexed from 1 to n. If it is not possible to build a simple undirected 3-regular graph with n vertices, print Impossible in a single line. 
 | |
| Constraints | |
| - 1 ≤ n ≤ 100 
 | |
| Sample Input | Output for Sample Input | 
| 4 3 0 | 6 1 2 1 3 1 4 2 3 2 4 3 4 Impossible | 
| 
 | |
| Problem setter: Manzurur Rahman Khan Original idea: Mohammad Mahmudur Rahman | |