#!/usr/bin/perl -w
$_ = <>;
m/^\s*0\s+0\s+2\s*$/ or
  m/^\s*2\s+0\s+0\s*$/ or
  die "Incorrect result on test case 1\n";
$_ = <>;
m/^\s*4\s+4\s+4\s+0\s+0\s+5\s+5\s*$/ or
  die "Incorrect result on test case 2\n";
$_ = <>;
m/^\s*8\s+8\s+8\s+9\s+9\s+9\s+8\s+0\s+0\s+9\s+8\s+8\s+8\s+9\s+9\s+9\s*$/ or
  die "Incorrect result on test case 3\n";
$_ = <>;
m/^\s*70\s+70\s+55\s+55\s+70\s+70\s+55\s+70\s+55\s+70\s+70\s+70\s+70\s+70\s+70\s+70\s+55\s+55\s+70\s+70\s+70\s+70\s+70\s+70\s+55\s+70\s+55\s+70\s+70\s+70\s+55\s+70\s+70\s+55\s+55\s+70\s+55\s+70\s+55\s+55\s+55\s+70\s+70\s+70\s+70\s+70\s+55\s+70\s+55\s+55\s+70\s+55\s+70\s+70\s+0\s+55\s+70\s+70\s+70\s+70\s+70\s+55\s+70\s+70\s+70\s+70\s+70\s+55\s+70\s+0\s+70\s+70\s*$/ or
  die "Incorrect result on test case 4\n";
$_ = <>;
m/^\s*8\s+8\s+8\s+68\s+68\s+68\s+68\s+0\s+8\s+68\s+68\s+68\s+8\s+68\s+8\s+8\s+8\s+8\s+8\s+8\s+8\s+8\s+8\s+8\s+68\s+68\s+68\s+8\s+8\s+8\s+8\s+8\s+68\s+8\s+8\s+8\s+8\s+8\s+8\s+8\s+68\s+8\s+8\s+8\s+8\s+8\s+68\s+68\s+8\s+8\s+8\s+68\s+8\s+8\s+8\s+8\s+8\s+8\s+8\s+8\s+8\s+8\s+8\s+8\s+8\s+8\s+8\s+0\s+8\s+68\s+8\s*$/ or
  die "Incorrect result on test case 5\n";
$_ = <>;
m/^\s*63\s+63\s+63\s+63\s+63\s+63\s+63\s+72\s+72\s+63\s+72\s+63\s+72\s+63\s+72\s+63\s+63\s+72\s+63\s+63\s+72\s+63\s+63\s+63\s+63\s+63\s+63\s+63\s+63\s+63\s+63\s+63\s+63\s+63\s+63\s+63\s+63\s+63\s+72\s+72\s+63\s+63\s+63\s+63\s+72\s+72\s+63\s+72\s+63\s+63\s+63\s+72\s+72\s+72\s+63\s+63\s+63\s+72\s+63\s+72\s+63\s+63\s+0\s+72\s+72\s+63\s+72\s+63\s+63\s+72\s+63\s+0\s+63\s+63\s+72\s+72\s+63\s+63\s+63\s+63\s+63\s+63\s+63\s+72\s+63\s+63\s+63\s+72\s+63\s+63\s+63\s+63\s+63\s+63\s+63\s+72\s+72\s+63\s*$/ or
  die "Incorrect result on test case 6\n";
$_ = <>;
m/^\s*38\s+14\s+14\s+14\s+14\s+14\s+14\s+38\s+14\s+14\s+38\s+14\s+38\s+0\s+38\s+14\s+14\s+14\s+14\s+14\s+14\s+14\s+14\s+14\s+14\s+14\s+14\s+14\s+14\s+14\s+14\s+14\s+14\s+14\s+14\s+14\s+14\s+0\s+14\s+38\s+38\s+14\s+14\s+14\s+14\s+14\s+14\s+38\s+38\s+38\s*$/ or
  die "Incorrect result on test case 7\n";
$_ = <>;
m/^\s*0\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+0\s+12\s+12\s*$/ or
  m/^\s*12\s+0\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+0\s+12\s+12\s*$/ or
  m/^\s*12\s+12\s+0\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+0\s+12\s+12\s*$/ or
  m/^\s*12\s+12\s+12\s+0\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+0\s+12\s+12\s*$/ or
  m/^\s*12\s+12\s+12\s+12\s+0\s+12\s+12\s+12\s+12\s+12\s+12\s+0\s+12\s+12\s*$/ or
  m/^\s*12\s+12\s+12\s+12\s+12\s+0\s+12\s+12\s+12\s+12\s+12\s+0\s+12\s+12\s*$/ or
  m/^\s*12\s+12\s+12\s+12\s+12\s+12\s+0\s+12\s+12\s+12\s+12\s+0\s+12\s+12\s*$/ or
  m/^\s*12\s+12\s+12\s+12\s+12\s+12\s+12\s+0\s+12\s+12\s+12\s+0\s+12\s+12\s*$/ or
  m/^\s*12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+0\s+12\s+12\s+0\s+12\s+12\s*$/ or
  m/^\s*12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+0\s+12\s+0\s+12\s+12\s*$/ or
  m/^\s*12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+0\s+0\s+12\s+12\s*$/ or
  m/^\s*12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+0\s+0\s+12\s*$/ or
  m/^\s*12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+12\s+0\s+12\s+0\s*$/ or
  die "Incorrect result on test case 8\n";
$_ = <>;
m/^\s*22\s+22\s+17\s+17\s+22\s+17\s+17\s+22\s+22\s+22\s+17\s+17\s+17\s+22\s+22\s+22\s+0\s+17\s+22\s+22\s+22\s+0\s+17\s+17\s+22\s+22\s+17\s+22\s+22\s+22\s+22\s+22\s+22\s+17\s+17\s+17\s+17\s+22\s+17\s+22\s+17\s*$/ or
  die "Incorrect result on test case 9\n";
$_ = <>;
m/^\s*20\s+20\s+23\s+20\s+20\s+20\s+20\s+20\s+20\s+23\s+23\s+20\s+20\s+23\s+20\s+20\s+20\s+23\s+20\s+0\s+20\s+23\s+0\s+20\s+20\s+20\s+20\s+20\s+23\s*$/ or
  m/^\s*26\s+20\s+26\s+26\s+20\s+20\s+20\s+20\s+20\s+20\s+20\s+20\s+20\s+26\s+20\s+26\s+20\s+26\s+20\s+0\s+20\s+20\s+20\s+20\s+20\s+0\s+26\s+20\s+20\s*$/ or
  die "Incorrect result on test case 10\n";
$_ = <>;
m/^\s*65\s+65\s+65\s+65\s+46\s+65\s+65\s+65\s+65\s+65\s+65\s+46\s+65\s+65\s+46\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s+46\s+46\s+46\s+46\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s+46\s+65\s+65\s+65\s+65\s+46\s+65\s+65\s+65\s+65\s+65\s+46\s+0\s+65\s+65\s+46\s+65\s+65\s+65\s+65\s+65\s+65\s+46\s+46\s+65\s+65\s+46\s+65\s+65\s+46\s+65\s+0\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s+65\s*$/ or
  die "Incorrect result on test case 11\n";
$_ = <>;
m/^\s*27\s+27\s+19\s+27\s+27\s+27\s+27\s+27\s+27\s+27\s+27\s+27\s+27\s+27\s+27\s+27\s+27\s+19\s+0\s+27\s+27\s+27\s+19\s+27\s+19\s+27\s+0\s+27\s+19\s+27\s+27\s+27\s+19\s+27\s+19\s+19\s+27\s+27\s+27\s+27\s+27\s+27\s+27\s+27\s+19\s+27\s+27\s+19\s*$/ or
  m/^\s*27\s+27\s+27\s+27\s+27\s+27\s+27\s+24\s+27\s+27\s+24\s+27\s+27\s+27\s+27\s+27\s+24\s+27\s+27\s+24\s+27\s+27\s+27\s+0\s+27\s+27\s+0\s+27\s+27\s+27\s+27\s+24\s+24\s+27\s+24\s+27\s+27\s+27\s+27\s+27\s+24\s+27\s+27\s+27\s+27\s+24\s+24\s+27\s*$/ or
  die "Incorrect result on test case 12\n";
$_ = <>;
m/^\s*12\s+7\s+12\s+7\s+7\s+12\s+0\s+7\s+7\s+7\s+7\s+0\s+7\s+7\s+12\s+12\s+7\s+7\s+7\s+7\s+7\s+12\s+7\s+7\s+7\s+7\s*$/ or
  m/^\s*24\s+7\s+24\s+7\s+7\s+24\s+0\s+7\s+7\s+7\s+7\s+7\s+7\s+7\s+7\s+24\s+7\s+7\s+7\s+7\s+7\s+24\s+24\s+0\s+7\s+7\s*$/ or
  die "Incorrect result on test case 13\n";
$_ = <>;
m/^\s*0\s+0\s+1\s+1\s+1\s+1\s+1\s+1\s+1\s+1\s*$/ or
  m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*6\s+6\s+6\s+6\s+6\s+0\s+6\s+6\s+0\s+6\s*$/ or
  m/^\s*10\s+10\s+10\s+10\s+10\s+0\s+10\s+10\s+10\s+0\s*$/ or
  m/^\s*6\s+6\s+6\s+6\s+6\s+0\s+6\s+6\s+6\s+0\s*$/ or
  m/^\s*8\s+8\s+8\s+8\s+8\s+8\s+0\s+0\s+8\s+8\s*$/ or
  m/^\s*9\s+9\s+9\s+9\s+9\s+9\s+0\s+9\s+0\s+9\s*$/ or
  m/^\s*10\s+10\s+10\s+10\s+10\s+10\s+0\s+10\s+10\s+0\s*$/ or
  m/^\s*9\s+9\s+9\s+9\s+9\s+9\s+9\s+0\s+0\s+9\s*$/ or
  m/^\s*8\s+8\s+8\s+8\s+8\s+8\s+8\s+0\s+0\s+8\s*$/ or
  m/^\s*10\s+10\s+10\s+10\s+10\s+10\s+10\s+0\s+10\s+0\s*$/ or
  m/^\s*8\s+8\s+8\s+8\s+8\s+8\s+8\s+0\s+8\s+0\s*$/ or
  m/^\s*10\s+10\s+10\s+10\s+10\s+10\s+10\s+10\s+0\s+0\s*$/ or
  m/^\s*9\s+9\s+9\s+9\s+9\s+9\s+9\s+9\s+0\s+0\s*$/ or
  die "Incorrect result on test case 14\n";
$_ = <>;
m/^\s*51\s+12\s+51\s+51\s+51\s+51\s+12\s+12\s+51\s+51\s+51\s+0\s+51\s+12\s+12\s+51\s+12\s+12\s+51\s+51\s+51\s+51\s+12\s+51\s+51\s+51\s+51\s+12\s+12\s+51\s+51\s+51\s+51\s+51\s+12\s+51\s+51\s+51\s+12\s+51\s+12\s+51\s+51\s+51\s+51\s+51\s+51\s+51\s+12\s+12\s+0\s+12\s+12\s+51\s+51\s+51\s+51\s+51\s+12\s+12\s+51\s+51\s+12\s+12\s+51\s+51\s+51\s+51\s+51\s+12\s+12\s+12\s+51\s+51\s+51\s+51\s+51\s+12\s*$/ or
  die "Incorrect result on test case 15\n";
$_ = <>;
m/^\s*4\s+4\s+4\s+0\s+4\s+8\s+4\s+0\s+4\s+4\s+4\s+8\s+4\s+4\s+8\s+8\s+4\s+8\s+8\s+4\s+8\s+4\s*$/ or
  die "Incorrect result on test case 16\n";
$_ = <>;
m/^\s*86\s+86\s+86\s+86\s+86\s+12\s+86\s+86\s+86\s+86\s+86\s+0\s+12\s+86\s+86\s+12\s+86\s+86\s+12\s+86\s+86\s+86\s+12\s+86\s+86\s+86\s+86\s+86\s+86\s+12\s+86\s+86\s+86\s+12\s+12\s+86\s+12\s+86\s+12\s+86\s+12\s+86\s+12\s+12\s+86\s+86\s+86\s+86\s+86\s+86\s+12\s+86\s+86\s+12\s+12\s+12\s+12\s+12\s+12\s+86\s+86\s+12\s+12\s+86\s+12\s+86\s+86\s+12\s+86\s+12\s+12\s+12\s+86\s+12\s+86\s+86\s+86\s+86\s+86\s+86\s+12\s+12\s+86\s+12\s+86\s+0\s+86\s+86\s+86\s+12\s*$/ or
  die "Incorrect result on test case 17\n";
$_ = <>;
m/^\s*0\s+3\s+0\s+1\s+1\s*$/ or
  die "Incorrect result on test case 18\n";
$_ = <>;
m/^\s*17\s+5\s+5\s+5\s+0\s+5\s+17\s+5\s+5\s+5\s+17\s+17\s+5\s+5\s+5\s+5\s+0\s*$/ or
  die "Incorrect result on test case 19\n";
$_ = <>;
m/^\s*95\s+95\s+95\s+39\s+95\s+95\s+39\s+95\s+95\s+39\s+95\s+95\s+39\s+39\s+95\s+39\s+39\s+95\s+39\s+39\s+39\s+95\s+39\s+95\s+95\s+95\s+39\s+39\s+39\s+39\s+39\s+39\s+95\s+95\s+39\s+95\s+95\s+39\s+0\s+39\s+39\s+39\s+39\s+39\s+39\s+95\s+95\s+95\s+39\s+39\s+95\s+95\s+95\s+39\s+39\s+95\s+39\s+95\s+95\s+39\s+95\s+95\s+95\s+39\s+39\s+39\s+95\s+95\s+95\s+95\s+95\s+39\s+39\s+95\s+39\s+95\s+39\s+95\s+39\s+39\s+95\s+39\s+39\s+95\s+39\s+95\s+95\s+95\s+95\s+39\s+39\s+39\s+95\s+95\s+0\s+39\s+95\s*$/ or
  die "Incorrect result on test case 20\n";
$_ = <>;
m/^\s*0\s+7\s+1\s+7\s+7\s+1\s+0\s+7\s+1\s*$/ or
  die "Incorrect result on test case 21\n";
$_ = <>;
m/^\s*7\s+7\s+7\s+15\s+15\s+7\s+0\s+7\s+7\s+15\s+7\s+15\s+7\s+15\s+0\s+15\s*$/ or
  die "Incorrect result on test case 22\n";
$_ = <>;
m/^\s*54\s+54\s+14\s+14\s+14\s+14\s+14\s+54\s+54\s+14\s+54\s+14\s+54\s+0\s+54\s+14\s+14\s+14\s+14\s+14\s+14\s+14\s+14\s+54\s+14\s+54\s+14\s+54\s+14\s+14\s+14\s+14\s+54\s+54\s+54\s+14\s+54\s+14\s+54\s+14\s+14\s+54\s+54\s+54\s+14\s+14\s+54\s+14\s+14\s+14\s+14\s+54\s+14\s+0\s+14\s+14\s+54\s+54\s+14\s*$/ or
  die "Incorrect result on test case 23\n";
$_ = <>;
m/^\s*3\s+50\s+0\s+3\s+3\s+50\s+50\s+50\s+50\s+3\s+50\s+3\s+50\s+50\s+3\s+3\s+3\s+50\s+3\s+3\s+50\s+50\s+3\s+3\s+50\s+3\s+50\s+50\s+50\s+50\s+3\s+50\s+50\s+3\s+50\s+3\s+3\s+3\s+3\s+50\s+3\s+3\s+50\s+50\s+3\s+3\s+3\s+3\s+3\s+0\s+50\s+3\s+3\s+3\s+3\s+3\s+50\s+50\s+50\s+3\s+50\s+50\s+3\s+3\s+50\s+50\s+50\s+3\s+3\s*$/ or
  die "Incorrect result on test case 24\n";
$_ = <>;
m/^\s*60\s+60\s+0\s+3\s+60\s+3\s+60\s+60\s+3\s+60\s+60\s+60\s+60\s+60\s+3\s+60\s+3\s+3\s+60\s+3\s+60\s+3\s+3\s+60\s+60\s+60\s+60\s+3\s+60\s+3\s+60\s+60\s+60\s+60\s+60\s+60\s+60\s+60\s+60\s+60\s+3\s+3\s+60\s+3\s+60\s+60\s+60\s+60\s+60\s+60\s+3\s+3\s+60\s+3\s+60\s+60\s+60\s+60\s+60\s+0\s+60\s+60\s+3\s+3\s+60\s*$/ or
  die "Incorrect result on test case 25\n";
$_ = <>;
m/^\s*51\s+7\s+51\s+51\s+7\s+51\s+0\s+7\s+7\s+7\s+7\s+7\s+51\s+7\s+7\s+51\s+7\s+7\s+7\s+7\s+7\s+7\s+7\s+7\s+7\s+7\s+7\s+7\s+7\s+7\s+7\s+51\s+7\s+7\s+7\s+7\s+7\s+7\s+7\s+7\s+7\s+7\s+51\s+51\s+7\s+7\s+7\s+7\s+7\s+7\s+0\s+7\s+7\s+7\s+7\s+51\s+7\s+7\s+7\s+7\s+7\s+7\s+7\s+7\s+7\s+51\s+7\s*$/ or
  die "Incorrect result on test case 26\n";
$_ = <>;
m/^\s*7\s+5\s+5\s+7\s+0\s+5\s+0\s+7\s+5\s+5\s+7\s+7\s+7\s+5\s+7\s+7\s+5\s+7\s+7\s+5\s+7\s+7\s+5\s+7\s+7\s+7\s+5\s+7\s+7\s+5\s+7\s+5\s+5\s+5\s+5\s+5\s+7\s+5\s+5\s+5\s+5\s+7\s+5\s+7\s*$/ or
  die "Incorrect result on test case 27\n";
$_ = <>;
m/^\s*91\s+91\s+91\s+91\s+38\s+91\s+91\s+91\s+91\s+91\s+38\s+91\s+91\s+38\s+91\s+38\s+91\s+38\s+91\s+91\s+38\s+38\s+91\s+38\s+38\s+38\s+38\s+38\s+38\s+91\s+38\s+38\s+38\s+91\s+91\s+91\s+91\s+0\s+91\s+91\s+91\s+38\s+91\s+91\s+38\s+91\s+38\s+38\s+38\s+38\s+38\s+91\s+91\s+38\s+91\s+38\s+91\s+91\s+91\s+91\s+91\s+91\s+91\s+91\s+91\s+91\s+91\s+91\s+91\s+91\s+38\s+91\s+38\s+38\s+91\s+38\s+38\s+38\s+91\s+91\s+38\s+91\s+38\s+91\s+91\s+38\s+91\s+38\s+91\s+91\s+0\s+91\s+91\s+38\s+91\s+91\s+38\s+38\s*$/ or
  die "Incorrect result on test case 28\n";
$_ = <>;
m/^\s*11\s+11\s+11\s+12\s+12\s+12\s+11\s+11\s+11\s+12\s+0\s+0\s+12\s+12\s+11\s+11\s+12\s+12\s*$/ or
  die "Incorrect result on test case 29\n";
$_ = <>;
m/^\s*27\s+27\s+27\s+42\s+27\s+27\s+27\s+42\s+27\s+27\s+27\s+27\s+27\s+27\s+27\s+27\s+42\s+27\s+27\s+27\s+42\s+27\s+27\s+27\s+27\s+27\s+0\s+42\s+27\s+27\s+42\s+42\s+27\s+27\s+27\s+27\s+27\s+27\s+27\s+27\s+27\s+0\s+27\s+27\s+27\s+27\s+27\s*$/ or
  die "Incorrect result on test case 30\n";
$_ = <>;
m/^\s*0\s+0\s*$/ or
  die "Incorrect result on test case 31\n";
$_ = <>;
m/^\s*21\s+21\s+21\s+21\s+8\s+21\s+21\s+0\s+21\s+21\s+8\s+21\s+21\s+8\s+21\s+21\s+21\s+21\s+8\s+21\s+0\s*$/ or
  die "Incorrect result on test case 32\n";
$_ = <>;
m/^\s*50\s+50\s+50\s+50\s+50\s+50\s+50\s+17\s+50\s+50\s+50\s+50\s+50\s+50\s+50\s+50\s+0\s+50\s+50\s+50\s+50\s+50\s+17\s+50\s+50\s+50\s+17\s+50\s+50\s+50\s+50\s+50\s+50\s+50\s+17\s+50\s+50\s+50\s+50\s+50\s+50\s+50\s+50\s+17\s+17\s+50\s+17\s+50\s+50\s+0\s+50\s+50\s+50\s+50\s+50\s+50\s+17\s+50\s+50\s+50\s+50\s+50\s+50\s+50\s+17\s+50\s+17\s+17\s+17\s+17\s+50\s+50\s+17\s+50\s+17\s+17\s*$/ or
  die "Incorrect result on test case 33\n";
$_ = <>;
m/^\s*46\s+49\s+49\s+49\s+46\s+46\s+49\s+49\s+49\s+46\s+46\s+49\s+49\s+49\s+46\s+49\s+46\s+49\s+46\s+49\s+46\s+46\s+46\s+46\s+46\s+46\s+46\s+49\s+46\s+49\s+49\s+46\s+49\s+49\s+46\s+46\s+46\s+46\s+49\s+46\s+49\s+49\s+46\s+46\s+49\s+0\s+46\s+49\s+0\s+46\s+46\s+46\s+46\s+49\s+46\s+49\s+46\s+46\s+46\s+46\s+46\s+46\s+49\s*$/ or
  die "Incorrect result on test case 34\n";
$_ = <>;
m/^\s*81\s+81\s+81\s+93\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+93\s+81\s+93\s+93\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+93\s+81\s+81\s+93\s+81\s+81\s+81\s+81\s+81\s+93\s+81\s+93\s+81\s+81\s+81\s+93\s+93\s+81\s+81\s+93\s+93\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+93\s+81\s+81\s+81\s+93\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s+93\s+0\s+81\s+81\s+93\s+93\s+81\s+81\s+81\s+93\s+81\s+81\s+81\s+0\s+81\s+81\s+81\s+81\s+81\s+81\s+81\s*$/ or
  die "Incorrect result on test case 35\n";
<> and die "Unexpected data after last test case";
0;
