#!/usr/bin/perl -w
require 5;
use strict;
my @nametree;
my @field;
my ($line, $index);

while (defined($line = <>)) {
	chomp($line);
	@field = (split(' ', $line));
	if ($field[0] =~ m:^/\.tmp_nametree/:) {
		$field[0] =~ m:/\.tmp_nametree(.*)/0*(\d+)$:;
		$nametree[$2] = $1;
	}
	if ($field[0] =~ m:^/\.tmp_shadow/:) {
		$field[0] =~ m:/\.tmp_shadow/(.*)/0*(\d+)$:;
		printf("%s %s %s %s %s\n",
			$1, $2, $field[2], $nametree[$2], $nametree[$field[2]]);
	}
}
