There is a rectangular grid with 3 rows and columns on a blackboard.
a. Find the number of ways to write exactly one of numbers into each square in such a way that all the following conditions are met:
(1) Different squares contain different numbers.
(2) For each , the numbers and are written into adjacent squares (i.e., squares having a common side).
(3) The numbers and are written into adjacent squares.
b. The same question, but as the 3rd condition, the number must be written into the leftmost and the number into the rightmost column.



