#K7836. Daily Animal Feeding Sequence

    ID: 35069 Type: Default 1000ms 256MiB

Daily Animal Feeding Sequence

Daily Animal Feeding Sequence

You are given a sequence of feeding orders for a zoo. On each day, animals are fed according to a cyclic order depending on the initial sequence type indicated by a character.

The three possible initial sequence types are:

  • A: Day 1: \(lion,\ tiger,\ bear\); Day 2: \(tiger,\ bear,\ lion\); Day 3: \(bear,\ lion,\ tiger\)
  • B: Day 1: \(tiger,\ bear,\ lion\); Day 2: \(bear,\ lion,\ tiger\); Day 3: \(lion,\ tiger,\ bear\)
  • C: Day 1: \(bear,\ lion,\ tiger\); Day 2: \(lion,\ tiger,\ bear\); Day 3: \(tiger,\ bear,\ lion\)

The feeding sequence for a given test case with \(N\) days is constructed by taking the first day's sequence and appending the subsequent days by rotating cyclically through the three orders (using modulo 3 arithmetic). Each day's sequence is separated by a semicolon and a space ("; ").

Your task is to generate the complete feeding sequence string for each test case.

inputFormat

The first line of input contains an integer \(T\), the number of test cases. Each of the following \(T\) lines contains an integer \(N\) and a character \(P\) separated by space, where \(N\) is the number of days and \(P\) is the initial sequence type ('A', 'B', or 'C').

outputFormat

For each test case, output a single line containing the computed feeding sequence. The sequences for each day are separated by "; " (a semicolon followed by a space).

## sample
1
1 A
lion, tiger, bear

</p>