There can be two cases:
Case (I) : When x row contains 6 *****:
Then the 2 can be arranged in y row in 6P2 ways = 15 or the 2 can be arranged in any of the 4 two box row in 4 ways.
So, no of ways, when x contains 6 ***** = 15 + 4 = 19.
Case (II) : Similarly, no. of ways, when y row contains 6 ***** = 19
As, either of case (I) or case (II) is possible,
Hence, total no. of ways = 19 + 19 = 38