while(<STDIN>){
    @key_word=split(/\s+/);
    chomp;
    if($key_word[0]=~/$ARGV[0]/ &&
       $ARGV[1]<=$key_word[1] && $key_word[1]<=$ARGV[2]){

	print "\# ".$_."\n";

	while(<STDIN>){
	    if($_=~/position/ || $_=~/time/){
		$read_data="TRUE";
		last;
	    }else{
		print $_;
	    }
	}

    }

    if($read_data=~/TRUE/){
	$read_data="";
	redo;
    }
}
