Upon arrival at an airport, passengers can pick up their luggage at a moving baggage carousel. The carousel rotates counterclockwise and is subdivided into compartments that each fit a single suitcase. First, the suitcases are transported from the aircraft to the baggage carousel by means of an automatic transport system. Afterwards, a porter drops the suitcases one by one on the carousel, always placing the next suitcase in the third empty compartment that passes by.

For example, suppose the porter has to drop five suitcases on a baggage carousel having eight compartments. For ease of reference, we have labeled the suitcases with the uppercase letters A, B, C, D and E, in the order the porter has to drop them on the carousel.

bagageband

After the porter has dropped the last suitcase (E) on the baggage carousel, we get the following situation.

bagageband

However, the carousel keeps spinning after all suitcases have been dropped, so that a few moments later the situation may look like this.

bagageband

Assignment

In this assignment we represent a baggage carousel as a list. The compartments of the carousel correspond to the elements of the list. Each element that corresponds to a compartment containing a suitcase is assigned a single character string (the label of the suitcase). We assume that all suitcases on the carousel are labeled with a different character. Each element that corresponds to an empty compartment is assigned the value None.

The order of the elements in the list corresponds to the order of the compartments that pass by the position of the porter, until all compartments have passed him. For example, the carousel that corresponds to the middle figure in the introduction is represented by the list ['E', 'A', None, 'D', 'B', None, None, 'C']. That same carousel, but read from the situation in the bottom figure in the introduction, is represented by the list ['B', None, None, 'C', 'E', 'A', None, 'D']. These are two different lists that represent the same baggage carousel. You are asked to:

Example

>>> carousel(8, 'ABCDE')
['E', 'A', None, 'D', 'B', None, None, 'C']
>>> carousel(5, 'ABCDE')
['E', 'C', 'B', 'D', 'A']

>>> rotated(['E', 'A', None, 'D', 'B', None, None, 'C'], ['B', None, None, 'C', 'E', 'A', None, 'D'])
True
>>> rotated(['E', 'A', None, 'D', 'B', None, None, 'C'], ['B', None, None, 'A', 'E', 'C', None, 'D'])
False
>>> rotated(['E', 'A', None, 'D', 'B', None, None, 'C'], ['C', 'E', 'A', None, 'D', 'B'])
False