while(<>) {                            
    chomp;                            
    @line = split;                    
     if ($line[0]=~/^[0-9][0-9]?/) {    
	$val=$line[0];                 
	$a=1;
      FRASE:for ($val==$a; $a++;) {    
	  $r=\@line;                  
	  if ($val==1) {
	      %frase = ();
	      %verb = ();
	      %subj = ();
	  }
	  %frase = ($r[0] => $r);  
	SUBJ:if ($frase{$r[0]}[7]=~/^subj$/){   
	    if ($frase{$r[0]}[4]=~/^S$|^SP$|^SW$/){ 
		if ($frase{$r[0]}[2]=~/^[A-Za-z]+[^@#\/%\=\$\^\*][-]?/){ 
		    $lemmasubj=\$frase{$r[0]}[2];
		    $cod=$frase{$r[0]}[0];        
		    $head=$frase{$r[0]}[6];            
		    $head=int $head;
		    $cod=int $cod;
		    %subj = ($cod=> [$head,$$lemmasubj]);
		}
	    }
	} 
	VERB:
	  if ($frase{$r[0]}[3]=~/^V$/){     
	      if ($frase{$r[0]}[2]=~/^[A-Za-z]+[^@#\/%\=\$\^\*][-]?/){       
		  $id=$frase{$r[0]}[0]; 
		  $lemmaverb=\$frase{$r[0]}[2];         
		  %verb = ($id=> [$id,$$lemmaverb]);
	      }
	  }  
	ID: {
	    if($verb{$id}[0]==$subj{$cod}[0]){
		print "$verb{$id}[1]\t$subj{$cod}[1]\n";
		delete $subj{$cod};
	    }
	  }
	  %frase = ();
	  last FRASE;                    
      } 
    }
}

