// Arup Guha
// 4/30/2007
// Solution to 2007 UCF HS Problem: Roboto, written in practice contest

import java.util.*;
import java.io.*;

public class roboto {

  public static void main(String[] args) throws IOException {

    Scanner fin = new Scanner(new File("roboto.in"));

    // Process cases.
    int numcases = fin.nextInt();
    for (int z=1; z<=numcases; z++) {

      // Read in adjacency array.
      int size = fin.nextInt();
      int[][] m = new int[size][size];
      for (int i=0; i<size*size; i++)
        m[i/size][i%size] = fin.nextInt();

      // No connections here.
      for (int i=0; i<size*size; i++)
        if (m[i/size][i%size] == -1)
          m[i/size][i%size] = 1;

      // Just Floyd's - easy to type, not really efficient though.
      for (int k=0; k<size; k++)
        for (int i=0; i<size; i++)
          for (int j=0; j<size; j++)
            if (m[i][k]+m[k][j] < m[i][j])
              m[i][j] = m[i][k]+m[k][j];

      // Output result.
      if (m[0][1] == 0)
        System.out.println("Circuit Design #"+z+": Back to the drawing board");
      else
        System.out.println("Circuit Design #"+z+": No more hedgehog troubles");
    }

    fin.close();
  }
}