what this code does (i think) is:
table 1 has 3 rows
table 2 has 4 rows
read table 1 row 1
read table 2 row 1
read table 2 row 2
read table 2 row 3
read table 2 row 4
read table 1 row 2
read table 2 row 1
read table 2 row 2
read table 2 row 3
read table 2 row 4
read table 1 row 3
read table 2 row 1
read table 2 row 2
read table 2 row 3
read table 2 row 4
i dont know if this works but try putting on the 2nd loop "if" instead of "while"