#!/usr/bin/perl

#ATOM     48  CA  LYS    49      67.099  59.971  67.836
#ATOM     49  CA  LYS    50      68.448  63.559  67.658
#ATOM     50  CA  ALA    51      69.136  63.955  71.416



open(LIST,$ARGV[0]);

$i=0;
$Apart=1;
while (<LIST>) {
  @line=split(/\s+/);
  if ($line[0] eq "ATOM") {
   if ($Apart == 1 ) {
      if ($line[1] < 2001) {
         $A[$i]=$line[4];
         $i++;
      }
      else {
        $Apart=0;
        $i=0;
        $B[$i] = $line[4];
        $i++;
      }
   }
   else {
      $B[$i]=$line[4];
      $i++;
   }
 }
}

for ($j=0;$j<$i;$j++) {
  print $A[$j], " ", $B[$j],"\n";
}


close(LIST);


