Match string from two file input

Hello all,

I have file like this:

file 1:

aa
bb
cc
dd
ee
file2:

111
111
111
111
111
111
222
222
222
333
333
333
333
333
444
444
555
555
555
555
555
555
555
555

desire output:

output:

111 aa
111 aa
111 aa
111 aa
111 aa
111 aa
222 bb
222 bb
222 bb
333 cc
333 cc
333 cc
333 cc
333 cc
444 dd
444 dd
555 ee
555 ee
555 ee
555 ee
555 ee
555 ee
555 ee
555 ee

thanks in advance

-attila

perl -ne 'BEGIN{open I,"< file1"; chomp(@x=<I>); close I; $i=-1}; chomp;
if (defined $y{$_}) { print "$_ $x[$i]\n" }
else { $y{$_} = $x[$i++]; print "$_ $x[$i]\n" }' file2
awk 'NR==FNR{a[i++]=$0;next}{if (x!=$0)j++;print $0,a[j];x=$0}' i=0 j=-1 file1 file2

Guru.