How do I get through the security gates?


Hint 1 of 9:
The gate system here is basically a complicated maze.

Hint 2 of 9:
You need to collect three black cards to get to the Pre-Approval room.

Hint 3 of 9:
Notice what happens whenever you walk into a different room here.

Hint 4 of 9:
You have to give up some of your security cards, but you get back cards of a
different color.

Hint 5 of 9:
All of the gates leading into the same room function the same way -- the
price for entering a room is the same, regardless of how you get there.

Hint 6 of 9:
Here are how the rooms exchange cards.  The colors on the left of the arrow
indicate the colors of the cards you have to give up, and the ones on the
right are for what you get back in exchange.  For example "BY->LR" means you
give up a blue (B) and yellow (Y) for a black (L) and red (R).
 
#p-#w-  LLL-->none    BY-->L        B-->YR
     (1)          (2)          (3)
     
   YR-->L       BY-->R       YR-->BB
     (4)          (5)          (6)
 
   BB-->YY       B-->YR      BR-->YY
     (7)          (8)          (9)#p+#w.
 
Preapproval is located at (1), and you get your cards outside (8) -- although
you can enter the maze at any location other than (1) and (5).

Hint 7 of 9:
If you go from (6) to (3), you will gain a blue card in sum.

Hint 8 of 9:
And if you go from (3) to (2) and back, you will exchange two blue cards for
a red and a black.

Hint 9 of 9:
So set up a cycle.  First, enter at (3).  Then go to (6), (3), (6), and (3)
to gain two blues, and then go to (2) and (3) to turn these into a red and
black.