Match elements in an AWK multi-dimensional array

Hello,

I have two files in the following format;

file1:

A B C D 
E F G H
I J  K L

file2:

1 2 3 4
5 6 7 8
9 10 11 12 

I have read them both in to multi-dimensional arrays. I need a file that has column 2 of the first file printed out for each column 3 of the second file ie...

output file:

B 3
B 7
B 11
F 3
F 7
F 11
J 3
J 7
J 11

Here is the code I have so far, any help would be appreciated. Or a better way of accomplishing this would be welcomed I am using a bourne shell.

{getline < "f1" } {for (j=1;j<=NF;j++) S[NR,j]=$j }  {getline < "f2"} { for (i=1;i<=NF;i++) G[NR,i]=$i } 
 
END { for (k=1;k<=3;k++) {print S[NR,2],G[k,3]}}' f1 f2
nawk '
# FNR and NR have the same values when dealing with the FIRST file passed on cli - "file2"
FNR==NR{f2[FNR]=$3;next}

# dealing with the SECOND file
# for every record/line in a file, iterate through array f2 (indexed by the record/line number,
# outputting second field ($2) from the current file/record AND the corresponding records in array f2
#
{for(i=1;i in f2;i++) print $2, f2}
' file2 file1

vgersh99

The code worked perfectly that method is pertty slick!

This is actually a subset of a larger problem, instead of printing the columns I am also trying to compare them. I will try and use your method in writing the rest of the code.

I am still learning AWK so, what is FNR doing in this code? Also the condition in the if statment "i in f2" what is it doing?

Thanks

updated code with comments