Infiltration#3391

Infiltration

3 seconds
256 megabytes
Very hard

Good morning, agent W-12. Your mission, should you choose to accept it, is as follows.

We are infiltrating the ever so insidious Association of Chaos and Mischief (ACM) in order to take down their command structure. Unfortunately, they appear to be prepared for such an eventuality, and have given their command structure an annoyingly complex design which makes our infiltration quite difficult.

The ACM command structure is divided into several cells. For each pair of cells and , either controls or controls . But this control relation can be cyclic, so it could happen that controls and controls and controls .

We can send in agents to infiltrate any particular cell, which gives us control over that cell and the cells that it controls, but not any other cells. So in the example above, infiltrating would give us control over and , but not .

For a successful infiltration of the ACM, we must obtain control over all of its cells, otherwise the cells that are out of our control will discover us and start causing some of their trademark chaos and mischief. As you know, we're on a tight spending leash from higher authority these days, so we need to execute this mission as efficiently as possible. Your mission is to figure out the minimum number of cells we need to infiltrate in order to succeed.

This mission briefing will self-destruct in five hours. Good luck!

Input

The first line of a test case contains the number of cells the ACM has (1 \leq n \leq 75). Each of the next lines contains a binary string of length where the -th character of the -th line is if cell controls cell , and otherwise (1 \leq i, j \leq n).

The -th character of the -th line is and for i \neq j, either the -th character of the -th line is or the -th character of the -th line is , but not both.

Output

For each test case, display its case number followed by the minimum number of cells that must be infiltrated to obtain complete control of the ACM. Then display numbers c_1, \ldots, c_m in any order, indicating the list of cells to infiltrate (cells are numbered from to ). If more than one set of cells gives complete control, any one will be accepted.

Examples

Example 1

Loading
Loading