Possible Duplicate:
In how many ways we can put $r$ distinct objects into $n$ baskets?

I have a doubt in following Combinatorics question : There are N bags, and there several balls of 4 colors (R,G,B,Y).Each bag should be filled by exactly one ball with the following condition -

-The color of ball in the consecutive bags must be different.

-The color of ball in first and last must be distinct too.

How many ways are there?

For N=2:

R   G
R   B
R   Y
G   R
G   B
G   Y
B   R
B   G
B   Y
Y   R
Y   G
Y   B

For N=3

B-1 B-2 B-3
R   G   B
R   G   Y
R   B   G
R   B   Y
R   Y   G
R   Y   B
G   R   B
G   R   Y
G   B   R
G   B   Y
G   Y   R
G   Y   B
B   R   G
B   R   Y
B   G   R
B   G   Y
B   Y   R
B   Y   G
Y   R   G
Y   R   B
Y   G   R
Y   G   B
Y   B   R
Y   B   G

marked as duplicate by Brian M. Scott, user940, Douglas S. Stones, Thomas, Rudy the Reindeer Oct 3 '12 at 8:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.