This page is still under construction.

Parts of this page are still being built. What you see may change.

Round Table

Interview

Time limit2sMemory limit1024 MB

Summary
Arrange m boys and n girls in a circle to maximize how many people have the neighbor pattern that makes them active, and output one such seating.
Level

Medium5 of 10

Topics
Greedy, String, Math, Implementation
Solved
No attempts yet

Problem

Reviving the old traditions of English knights, in one city the members of a school computer science club gather around a round table every week and discuss the results of recent contests.

The club advisor Ivan Petrovich recently noticed that not all the students take an active part in the discussion. After watching several club meetings, he noticed that a member's activity depends on who sits next to them.

There are mm boys and nn girls in the club. Ivan Petrovich noticed that a boy takes an active part in the discussion only when girls sit immediately next to him on both sides, and a girl takes an active part in the discussion only when a boy sits next to her on one side and a girl on the other.

Wanting to make the club meeting as interesting as possible, Ivan Petrovich decided to seat the members around a round table so that as many members as possible take an active part in the discussion.

Given the numbers mm and nn, write a program that outputs a way to seat mm boys and nn girls around a round table such that the maximum number of club members take an active part in the discussion.

Input

The input file contains two integers mm and nn separated by exactly one space (0≤m≤10000 \le m \le 1000, 0≤n≤10000 \le n \le 1000, m+n≥3m + n \ge 3).

Output

The output file must contain a single line with mm characters «B» (uppercase Latin letter) and nn characters «G» (uppercase Latin letter) arranged in some order. The character «B» denotes a boy, and «G» denotes a girl.

The characters must be arranged in the order in which the club members are to be seated around the table. Adjacent characters correspond to members who sit next to each other. The members corresponding to the first and last characters of the output line also sit next to each other.

Hint

In the first example, all club members take an active part in the discussion.

In the second example, the boys take an active part in the discussion and the girls do not. In this example the members can also be seated as follows: «BBGG». In that case both girls take an active part in the discussion and the boys do not. It is impossible to seat everyone so that three or four club members take an active part in the discussion.

Examples2

  1. Example 1

    Input
    1 2
    
    Expected output
    BGG
    
  2. Example 2

    Input
    2 2
    
    Expected output
    BGBG