#!/usr/bin/perl -w 
use strict;

my $bits = 16;
my $i;
my @antipode;
my $count;
my $j;
my $old;
my $temp1;
my $temp2;
my $listcount = 0;

while(<>) {

    $antipode[0] = $_;

    for($i=1; $i<2*$bits; $i++)
    {
	$antipode[$i] = <>;
    }

    $listcount++;
#    print "list $listcount read in\n";

    for($i=0; $i<$bits; $i++) {
	$count=0;
	
	$_ = $antipode[$i];
	$old = $antipode[$i + $bits];
	
	for($j=0; $j<$bits; $j++) {
	    if(/[10]{$j}([10])/) {
		$temp1 = $1;
	    }
	    else {die("failure on new bit ".$j." get");}
	    if($old =~ m/[10]{$j}([10])/) {
		$temp2 = $1;
	    }
	    else {die("failure on old bit ".$j." get");}
	    
	    if($temp1 ne $temp2) {$count++;}
	}
	if($count < $bits) {
	    die("antipode not reached");
	}
    }
}
