sub bin {
  my $z=hex shift;
  $y="";
  for ($i=0;$i<8;$i++) {
	$y .= ($z&(1<<$i)) ? "1" : "0";
  }
  return $y;
}

undef $/;
$_ = <>;

/_width\s+(\d+)/;  $w = $1;
/_height\s+(\d+)/; $h = $1;
@a = (/(0x[\da-fA-F][\da-fA-F])/g);
while (@a) {
  for ($x = 0; $x < $w/8; $x++) {
	print bin(shift @a), " ";
  }
  print "\n";
}
