beecrowd | 1944

FACE 2015 FREE GIFT

By Tiago Zonta, Unoesc Campus Chapecó BR Brazil

Timelimit: 1

In this year of 2015, FACE is supporting the third edition of the Programming Marathon, but, at this time, organization's staff is requesting your help to create a lottery system by using the FACE letters. As this fair uses a differentiated and cheerful proposal, each participant who enters into the fair receives 4 letters, each of them in a different color and in the form of a wooden block, as shown in Figure 1, and they must insert them in a panel. If, by the entering time, the 4 letters create the opposite of the 4 last letters, this visitor will receive the free gift.

Brinde_FACE

Figure 1 - FACE entrance on the panel followed by ACEF.

For example: suppose there have already been three visitors who entered into the fair and the letters' distribution remained as follows: F A C E E C F A A C F E A C E F. See that the panel, for being empty, the letters F A C E were inserted in order to start the process, now, as the fourth visitor enters, he has inserted the letters F E C A and, with it, they will receive the free gift as it got the opposite of A C E F. After this situation, the letters must remain F A C E E C F A A C F E. Another important fact is that, the free gifts' distribution occurs in a certain period with a sample of a selected visitors number. REMENBER, always when the panel remains empty it is automatically inserted the letters F A C E.

Input

The input contains several test cases. The first line of a test case contains an integer N (1 ≤ N ≤ 100), representing the number of visitors who will receive the letters. In each subsequent line it must be informed the 4 letters combination separated by space that the visitor wishes to insert on the panel. The stop is determined by N equals to 0.

Output

For each of group of visitors, it must be informed how many of them will receive free gifts.

Input Samples Output Samples

4

E C F A

A C E F

F E C A

A F C E

2

3

E A C F

A F C E

E F C A

0

6

E C A F

E C A F

E C A F

E C A F

E C A F

E C A F

6