P16553 [ICPC 2026 LAC] GATA-CAT
Description
A DNA sequence is a molecular chain composed of the four nucleobases: cytosine (C), guanine (G), adenine (A), and thymine (T). Those letters can be used to encode a genetic sequence as text.
Previously, we hypothesized that felines owe their traits to what we call their *CAT degree*. It’s the number of times that their genetic sequence contains the nucleobases C-A-T in that order, ignoring other nucleobases between them. For instance, the sequences “GACT”, “GCAT”, and “CCGAAGT” have CAT degrees $0$, $1$, and $4$, respectively.
It turns out that was only half the picture. Researchers from Latin America were surprised to find healthy cats with below-average CAT degrees. Upon further study, they determined that there is a second factor regulating feline traits, now known as *GATA degree*. Similar to CAT degree, it’s the number of times that a genetic sequence contains the nucleobases G-A-T-A in that order, ignoring other nucleobases between them.
Today you’ll be crafting fresh DNA sequences in the lab. We will ask you for short genetic sequences (at most $500$ nucleobases) having specific GATA and CAT degrees. Please write a program to assist in our research.
Input Format
The first line contains an integer $Q$ ($1 \le Q \le 1000$) indicating the number of sequences that must be crafted.
Each of the next $Q$ lines contains two integers $G$ and $C$ ($0 \le G, C \le 10^6$), representing respectively the required GATA and CAT degrees.
Output Format
For each request in the input, output a line with a non-empty string of at most $500$ uppercase letters “C”, “G”, “A”, or “T”, having the specified GATA and CAT degrees.
It can be proven that a valid answer exists under the given constraints. If there are multiple solutions, output any of them; there is no need to minimize the length of the strings.