Catherine has a deck of n cards, each of which is either red, green, or blue. As long as there are at least two cards left, she can do one of two actions:   take any two (not necessarily adjacent) cards with different colors and exchange them for a new card of the third color;  take any two (not necessarily adjacent) cards with the same color and exchange them for a new card with that color. 

She repeats this process until there is only one card left. What are the possible colors for the final card?


-----Input-----

The first line of the input contains a single integer n (1 ≤ n ≤ 200) — the total number of cards.

The next line contains a string s of length n — the colors of the cards. s contains only the characters 'B', 'G', and 'R', representing blue, green, and red, respectively.


-----Output-----

Print a single string of up to three characters — the possible colors of the final card (using the same symbols as the input) in alphabetical order.


-----Examples-----
Input
2
RB

Output
G

Input
3
GRG

Output
BR

Input
5
BBBBB

Output
B



-----Note-----

In the first sample, Catherine has one red card and one blue card, which she must exchange for a green card.

In the second sample, Catherine has two green cards and one red card. She has two options: she can exchange the two green cards for a green card, then exchange the new green card and the red card for a blue card. Alternatively, she can exchange a green and a red card for a blue card, then exchange the blue card and remaining green card for a red card.

In the third sample, Catherine only has blue cards, so she can only exchange them for more blue cards.

Difficulty: EASY
Tags: Dynamic programming

Mathematics

Constructive algorithms
Skill types: Dynamic programming

Starter code:

Solutions:
from collections import namedtuple

def __starting_point():
	n = int(input())
	cards = input()
	r = 0
	g = 0
	b = 0
	for card in cards:
		if card == 'R':
			r += 1
		elif card == 'G':
			g += 1
		elif card == 'B':
			b += 1
	colornum = 0
	if r:
		colornum += 1
	if g:
		colornum += 1
	if b:
		colornum += 1
	res = ''
	if colornum == 3:
		res = 'BGR'
	elif colornum == 2:
		if r == 1:
			if b == 1:
				res = 'G'
			elif b > 1:
				res = 'GR'
			elif g == 1:
				res = 'B'
			elif g > 1:
				res = 'BR'
		elif g == 1:
			if r == 1:
				res = 'B'
			elif b == 1:
				res = 'R'
			elif r > 1:
				res = 'BG'
			elif b > 1:
				res = 'GR'
		elif b == 1:
			if r == 1:
				res = 'G'
			elif g == 1:
				res = 'R'
			elif r > 1:
				res = 'BG'
			elif g > 1:
				res = 'BR'
		else:
			res = 'BGR'
	elif r:
		res = 'R'
	elif g:
		res = 'G'
	elif b:
		res = 'B'
	print(res)
__starting_point()


def cnt(a, e):
	res = 0
	for i in s:
		if i == e:
			res += 1
	return res
n = input()
s = input()
a1 = cnt(s, 'R')
a2 = cnt(s, 'G')
a3 = cnt(s, 'B')
if a1 and (not a2) and (not a3):
	print('R')
elif a2 and (not a1) and (not a3):
	print('G')
elif a3 and (not a2) and (not a1):
	print('B')
elif a1 + a2 + a3 == 2:
	se = set(['R', 'G', 'B'])
	se -= set(s)
	for i in se:
		print(i)
elif a1 > 1 and a2 + a3 == 1:
	print('BG')
elif a2 > 1 and a1 + a3 == 1:
	print('BR')
elif a3 > 1 and a1 + a2 == 1:
	print('GR')
else:
	print('BGR')


n = int(input())
s = input()
l = len(s)
letters = set(s)
all_letters = {'B', 'G', 'R'}
if len(letters) == 3:
	print(''.join(all_letters))
elif len(letters) == 2:
	if l == 2:
		print(''.join(sorted(all_letters - letters)))
	else:
		(a, b) = letters
		count_a = s.count(a)
		count_b = s.count(b)
		if count_a >= 2 and count_b >= 2:
			print(''.join(all_letters))
		elif count_a > count_b:
			print(''.join(sorted((all_letters - letters).union(b))))
		elif count_b > count_a:
			print(''.join(sorted((all_letters - letters).union(a))))
else:
	print(''.join(letters))


n = int(input())
s = input()
r = s.count('R')
g = s.count('G')
b = s.count('B')
if r >= 1 and g >= 1 and (b >= 1):
	print('BGR')
elif r + g == 0:
	print('B')
elif b + g == 0:
	print('R')
elif b + r == 0:
	print('G')
elif r == 0:
	if b + g == 2:
		print('R')
	elif b == 1 and g > 1:
		print('BR')
	elif g == 1 and b > 1:
		print('GR')
	else:
		print('BGR')
elif b == 0:
	if r + g == 2:
		print('B')
	elif r == 1 and g > 1:
		print('BR')
	elif g == 1 and r > 1:
		print('BG')
	else:
		print('BGR')
elif g == 0:
	if b + r == 2:
		print('G')
	elif b == 1 and r > 1:
		print('BG')
	elif r == 1 and b > 1:
		print('GR')
	else:
		print('BGR')


n = int(input())
s = input()
b = s.count('B')
r = s.count('R')
g = s.count('G')
if 'B' in s and 'G' in s and ('R' in s):
	print('BGR')
elif s == 'B' * n:
	print('B')
elif s == 'G' * n:
	print('G')
elif s == 'R' * n:
	print('R')
elif 'B' not in s:
	if g == r == 1:
		print('B')
	elif g > 1 and r > 1:
		print('BGR')
	elif g == 1 and r > 1:
		print('BG')
	elif g > 1 and r == 1:
		print('BR')
elif 'G' not in s:
	if b == r == 1:
		print('G')
	elif b > 1 and r > 1:
		print('BGR')
	elif b == 1 and r > 1:
		print('BG')
	elif b > 1 and r == 1:
		print('GR')
elif 'R' not in s:
	if b == g == 1:
		print('R')
	elif b > 1 and g > 1:
		print('BGR')
	elif b == 1 and g > 1:
		print('BR')
	elif b > 1 and g == 1:
		print('GR')


3
n = int(input())
s = str(input())
colors = set()
for i in s:
	colors.add(i)
if len(colors) == 1:
	print(s[0])
elif len(colors) == 3:
	print('BGR')
elif s.count('R') == 0:
	if s.count('G') >= 2 and s.count('B') >= 2:
		print('BGR')
	elif s.count('G') >= 2 and s.count('B') == 1:
		print('BR')
	elif s.count('G') == 1 and s.count('B') >= 2:
		print('GR')
	elif s.count('G') == 1 and s.count('B') == 1:
		print('R')
elif s.count('G') == 0:
	if s.count('R') >= 2 and s.count('B') >= 2:
		print('BGR')
	elif s.count('R') >= 2 and s.count('B') == 1:
		print('BG')
	elif s.count('R') == 1 and s.count('B') >= 2:
		print('GR')
	elif s.count('R') == 1 and s.count('B') == 1:
		print('G')
elif s.count('B') == 0:
	if s.count('R') >= 2 and s.count('G') >= 2:
		print('BGR')
	elif s.count('R') >= 2 and s.count('G') == 1:
		print('BG')
	elif s.count('R') == 1 and s.count('G') >= 2:
		print('BR')
	elif s.count('R') == 1 and s.count('G') == 1:
		print('B')


from collections import Counter, deque
from sys import stdin

class UniqueDeque(deque):

	def appendleft(self, *args, **kwargs):
		if args[0] not in self:
			return super().appendleft(*args, **kwargs)

def solve(s: str):
	c = Counter(s)
	t = (min(c['R'], 3), min(c['G'], 3), min(c['B'], 3))
	d = UniqueDeque()
	d.append(t)
	while any(filter(lambda x: x > 1, map(sum, d))):
		i = d.pop()
		if i[0] > 1:
			d.appendleft((i[0] - 1, i[1], i[2]))
		if i[1] > 1:
			d.appendleft((i[0], i[1] - 1, i[2]))
		if i[2] > 1:
			d.appendleft((i[0], i[1], i[2] - 1))
		if i[0] and i[1]:
			d.appendleft((i[0] - 1, i[1] - 1, i[2] + 1))
		if i[0] and i[2]:
			d.appendleft((i[0] - 1, i[1] + 1, i[2] - 1))
		if i[1] and i[2]:
			d.appendleft((i[0] + 1, i[1] - 1, i[2] - 1))
	res = []
	if (1, 0, 0) in d:
		res.append('R')
	if (0, 1, 0) in d:
		res.append('G')
	if (0, 0, 1) in d:
		res.append('B')
	return ''.join(sorted(res))
_in = iter(stdin.readlines())
n = int(next(_in))
s = str(next(_in))[:-1]
print(solve(s))


from collections import deque as de
import math
from math import sqrt as sq
from math import floor as fl
from math import ceil as ce
from sys import stdin, stdout
import re
from collections import Counter as cnt
from functools import reduce
from itertools import groupby as gb
from bisect import bisect_left as bl, bisect_right as br

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binarytodecimal(n):
	return int(n, 2)

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic

def Log2(x):
	return math.log10(x) / math.log10(2)

def getProduct(n):
	product = 1
	while n != 0:
		product = product * (n % 10)
		n = n // 10
	return product

def lcm(x, y):
	lcm = x * y // math.gcd(x, y)
	return lcm

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))

def checkisap(list):
	d = list[1] - list[0]
	for i in range(2, len(list)):
		temp = list[i] - list[i - 1]
		if temp != d:
			return False
	return True

def primes_method5(n):
	out = {}
	sieve = [True] * (n + 1)
	for p in range(2, n + 1):
		if sieve[p]:
			out[p] = 1
			for i in range(p, n + 1, p):
				sieve[i] = False
	return out

def ceildiv(x, y):
	return (x + y - 1) // y

def di():
	return map(int, input().split())

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def si():
	return list(map(str, input()))

def indict():
	dic = {}
	for (index, value) in enumerate(input().split()):
		dic[int(value)] = int(index) + 1
	return dic

def frqdict():
	dic = {}
	for (index, value) in enumerate(input()):
		if value not in dic:
			dic[value] = 1
		else:
			dic[value] += 1
	return dic
n = ii()
s = si()
if len(set(s)) == 1:
	print(s[0])
elif len(set(s)) == 3:
	print('BGR')
else:
	a = set(['R', 'G', 'B'])
	if n == 2:
		print(*a - set(s))
	else:
		dic = get_frequency(s)
		countlist = list(dic.values())
		if min(countlist) >= 2:
			print('BGR')
		else:
			ans = []
			for ele in a:
				if ele not in dic:
					ans.append(ele)
					break
			for key in dic:
				if dic[key] == 1:
					ans.append(key)
					break
			ans.sort()
			print(*ans, sep='')


def main():
	from collections import Counter
	n = int(input())
	if n == 1:
		print(input())
		return
	cnt = Counter({'R': 0, 'G': 0, 'B': 0})
	cnt.update(input())
	(r, g, b) = sorted('RGB', key=cnt.get)
	print(''.join(sorted('RGB' if cnt[r] else (r if n == 2 else r + g) if cnt[g] == 1 else 'RGB' if cnt[g] else b)))
main()


input()
s = input()
(r, g, b) = [s.count(x) for x in 'RGB']
(A, B, C) = sorted([(r, 'R'), (g, 'G'), (b, 'B')], reverse=True)
if C[0] or B[0] > 1:
	print('BGR')
elif B[0] and A[0] >= 2:
	print(''.join(sorted((x[1] for x in (B, C)))))
elif B[0]:
	print(C[1])
elif A[0]:
	print(A[1])


n = int(input())
s = input()
k = []
for i in s:
	k.append(i)
k = set(k)
if 'R' in s and 'B' in s and ('G' in s):
	print('BGR')
	exit()
elif len(s) > 2 and len(k) == 2:
	if s.count('R') > 1 and s.count('B') == 1:
		print('BG')
		exit()
	elif s.count('G') > 1 and s.count('B') == 1:
		print('BR')
		exit()
	elif s.count('B') > 1 and s.count('R') == 1:
		print('GR')
		exit()
	elif s.count('G') > 1 and s.count('R') == 1:
		print('BR')
		exit()
	elif s.count('B') > 1 and s.count('G') == 1:
		print('GR')
		exit()
	elif s.count('R') > 1 and s.count('G') == 1:
		print('BG')
		exit()
	elif s.count('R') > 1 and s.count('B') > 1:
		print('BGR')
	elif s.count('B') > 1 and s.count('G') > 1:
		print('BGR')
	elif s.count('R') > 1 and s.count('G') > 1:
		print('BGR')
elif len(k) == 2:
	if 'G' not in k:
		print('G')
		exit()
	elif 'R' not in k:
		print('R')
		exit()
	elif 'B' not in k:
		print('B')
		exit()
else:
	print(*k)


import io
import sys
import time
import random
n = int(input())
cols = 'RGB'
counts = {'R': 0, 'G': 0, 'B': 0}
for c in input():
	counts[c] += 1

def gettwocolors(counts):
	if counts['R'] == 0:
		return 'GB'
	if counts['G'] == 0:
		return 'RB'
	if counts['B'] == 0:
		return 'RG'

def printcols(cols):
	print(sortedcols(cols))

def sortedcols(cols):
	return ''.join(sorted(list(cols)))
complement = {sortedcols('RG'): 'B', sortedcols('RB'): 'G', sortedcols('GB'): 'R'}
if counts['R'] > 0 and counts['G'] > 0 and (counts['B'] > 0):
	printcols('RGB')
else:
	(c1, c2) = gettwocolors(counts)
	if counts[c1] == 0:
		printcols(c2)
	elif counts[c2] == 0:
		printcols(c1)
	elif counts[c1] >= 2 and counts[c2] >= 2:
		printcols('RGB')
	elif counts[c1] >= 2:
		printcols(c2 + complement[sortedcols(c1 + c2)])
	elif counts[c2] >= 2:
		printcols(c1 + complement[sortedcols(c1 + c2)])
	else:
		printcols(complement[sortedcols(c1 + c2)])


from sys import stdin
n = int(stdin.readline())
s = stdin.readline()
arr = [0, 0, 0]
for i in s:
	if i == 'B':
		arr[0] += 1
	elif i == 'G':
		arr[1] += 1
	elif i == 'R':
		arr[2] += 1
possible = [False, False, False]

def f(l):
	if l[0] != 0 and l[1] != 0 and (l[2] != 0):
		(possible[0], possible[1], possible[2]) = (True, True, True)
	elif l[1] == 0 and l[2] == 0:
		possible[0] = True
	elif l[2] == 0 and l[0] == 0:
		possible[1] = True
	elif l[0] == 0 and l[1] == 0:
		possible[2] = True
	elif l[0] != 0 and l[1] != 0:
		possible[2] = True
		f([l[0] - 1, l[1] - 1, l[2] + 1])
	elif l[1] != 0 and l[2] != 0:
		possible[0] = True
		f([l[0] + 1, l[1] - 1, l[2] - 1])
	elif l[2] != 0 and l[0] != 0:
		possible[1] = True
		f([l[0] - 1, l[1] + 1, l[2] - 1])
f(arr)
ans = ''
if possible[0] == True:
	ans += 'B'
if possible[1] == True:
	ans += 'G'
if possible[2] == True:
	ans += 'R'
print(ans)


from sys import stdin, stdout, setrecursionlimit

class Tail_Recursion_Optimization:

	def __init__(self, RECURSION_LIMIT, STACK_SIZE):
		setrecursionlimit(RECURSION_LIMIT)
		threading.stack_size(STACK_SIZE)
		return None

class SOLVE:

	def solve(self):
		R = stdin.readline
		W = stdout.write
		n = int(R())
		s = list(R()[:-1])
		s.sort()
		s = ''.join(s)
		(r, g, b) = (s.count('R'), s.count('G'), s.count('B'))
		check = bool(r) + bool(g) + bool(b)
		ans = ''
		if check == 3:
			ans = 'BGR'
		elif check == 1:
			ans = s[0]
		elif check == 2:
			if n == 2:
				ans = 'R' if s == 'BG' else 'B' if s == 'GR' else 'G'
			elif r == 1 or g == 1 or b == 1:
				if r == 1:
					if g:
						ans = 'BR'
					elif b:
						ans = 'GR'
				elif g == 1:
					if b:
						ans = 'GR'
					elif r:
						ans = 'BG'
				elif b == 1:
					if r:
						ans = 'BG'
					elif g:
						ans = 'BR'
			else:
				ans = 'BGR'
		W('%s\n' % ans)
		return 0

def main():
	s = SOLVE()
	s.solve()
main()


input()
s = input()
(a, b, c) = sorted(((s.count(x), x) for x in 'RGB'))
if a[0] or b[0] > 1:
	print('BGR')
elif b[0] and c[0] > 1:
	print(''.join(sorted(a[1] + b[1])))
elif b[0]:
	print(a[1])
else:
	print(c[1])


n = int(input())
s = {'R', 'G', 'B'}
l = list(input())
if len(set(l)) == 1:
	print(l[0])
elif len(set(l)) == 3:
	print('B' + 'G' + 'R')
else:
	l2 = list(set(l))
	a = []
	s2 = s - set(l)
	for i in s2:
		a.append(i)
	c1 = 0
	c2 = 0
	for i in range(n):
		if l[i] == l2[0]:
			c1 += 1
		elif l[i] == l2[1]:
			c2 += 1
	if c1 >= 2:
		a.append(l2[1])
	if c2 >= 2:
		a.append(l2[0])
	a.sort()
	for i in range(len(a)):
		if i == len(a) - 1:
			print(a[i])
		else:
			print(a[i], end='')


from sys import exit
n = int(input())
s = input()
if 'R' in s and 'G' in s and ('B' in s):
	print('BGR')
	exit()
if 'R' not in s and 'G' not in s:
	print('B')
	exit()
if 'R' not in s and 'B' not in s:
	print('G')
	exit()
if 'B' not in s and 'G' not in s:
	print('R')
	exit()
if 'R' in s and 'G' in s:
	answer = 'B'
	if s.count('R') > 1:
		answer += 'G'
	if s.count('G') > 1:
		answer += 'R'
	print(answer)
	exit()
if 'R' in s and 'B' in s:
	answer = 'G'
	if s.count('R') > 1:
		answer = 'B' + answer
	if s.count('B') > 1:
		answer += 'R'
	print(answer)
	exit()
if 'B' in s and 'G' in s:
	answer = 'R'
	if s.count('B') > 1:
		answer = 'G' + answer
	if s.count('G') > 1:
		answer = 'B' + answer
	print(answer)
	exit()


import collections as cc
I = lambda : list(map(int, input().split()))
(n,) = I()
F = cc.Counter(input())
if len(F) < 2:
	print(*F)
elif len(F) > 2:
	print('BGR')
else:
	(f1, f2) = F.values()
	if f1 == f2 == 1:
		print((set('BGR') - set(F.keys())).pop())
	elif f1 > 1 and f2 > 1:
		print('BGR')
	else:
		print(*(c for c in 'BGR' if c not in F or F[c] == 1), sep='')


import sys

def possible(c, s):
	pass

def main():
	sys.stdin.readline()
	s = sys.stdin.readline()
	ng = s.count('G')
	nr = s.count('R')
	nb = s.count('B')
	res = ''
	if ng * nr > 0:
		res = 'B'
	elif ng + nr == 0:
		res = 'B'
	else:
		res = 'B' if nb > 0 and (nr >= 2 or ng >= 2) else ''
	if nb * nr > 0:
		res += 'G'
	elif nb + nr == 0:
		res += 'G'
	else:
		res += 'G' if ng > 0 and (nb >= 2 or nr >= 2) else ''
	if nb * ng > 0:
		res += 'R'
	elif nb + ng == 0:
		res += 'R'
	else:
		res += 'R' if nr > 0 and (ng >= 2 or nb >= 2) else ''
	print(res)
main()


import os
import sys
from io import BytesIO, IOBase

def main():
	n = int(input())
	s = input().rstrip()
	a = set(s)
	la = len(a)
	if la == 1:
		print(a.pop())
	elif la == 3:
		print('BGR')
	else:
		z = a.pop() + a.pop()
		if n == 2 and la == 2:
			for i in 'RBG':
				if i not in z:
					print(i)
					break
		elif s.count(z[0]) > 1 and s.count(z[1]) > 1:
			print('BGR')
		else:
			a = ['B', 'G', 'R']
			if s.count(z[0]) > s.count(z[1]):
				a.remove(z[0])
			else:
				a.remove(z[1])
			print(''.join(a))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
cards = input()
(r, b, g) = (0, 0, 0)
for i in range(0, n):
	if cards[i] == 'R':
		r += 1
	elif cards[i] == 'B':
		b += 1
	else:
		g += 1
if r >= 1 and b >= 1 and (g >= 1) or (r > 1 and b > 1) or (r > 1 and g > 1) or (b > 1 and g > 1):
	print('BGR')
elif r == 1 and b == 1:
	print('G')
elif b == 1 and g == 1:
	print('R')
elif r == 1 and g == 1:
	print('B')
elif r > 1 and b == 1:
	print('BG')
elif b > 1 and g == 1:
	print('GR')
elif g > 1 and r == 1:
	print('BR')
elif r == 1 and b > 1:
	print('GR')
elif b == 1 and g > 1:
	print('BR')
elif g == 1 and r > 1:
	print('BG')
elif r >= 1:
	print('R')
elif b >= 1:
	print('B')
else:
	print('G')


n = int(input())
cards = input()
rc = ('R', cards.count('R'))
gc = ('G', cards.count('G'))
bc = ('B', cards.count('B'))
r = 'RGB'
a = [rc, gc, bc]
a.sort(key=lambda item: item[1])
if a[0][1] == 0:
	if a[1][1] == 0:
		r = a[2][0]
	elif a[1][1] != a[2][1] and a[1][1] == 1:
		r = a[1][0] + a[0][0]
	elif a[1][1] == 1:
		r = a[0][0]
print(''.join(sorted(r)))


n = int(input())
s = input()
l = []
v = [0, 0, 0]

def val(c):
	if c == 'B':
		return 0
	elif c == 'G':
		return 1
	else:
		return 2
for c in s:
	l += [val(c)]
	v[val(c)] += 1
if len(set(l)) == 3:
	print('BGR')
elif len(set(l)) == 1:
	print(s[0])
elif v[0] == 1 or v[1] == 1 or v[2] == 1:
	a = ''
	if v[0] == 0:
		a = 'B'
	elif v[1] == 0:
		a = 'G'
	else:
		a = 'R'
	if max(v) > 1:
		if v[0] == 1:
			a += 'B'
		elif v[1] == 1:
			a += 'G'
		else:
			a += 'R'
	for c in sorted(a):
		print(c, end='')
else:
	print('BGR')


t = input()
d = input()
r = d.count('R')
g = d.count('G')
b = d.count('B')
if r > 0 and g > 0 and (b > 0):
	print('BGR')
	exit(0)
if r == 0 and g == 0:
	print('B')
	exit(0)
if r == 0 and b == 0:
	print('G')
	exit(0)
if b == 0 and g == 0:
	print('R')
	exit(0)
if b == 1 and r == 1:
	print('G')
	exit(0)
if b == 1 and g == 1:
	print('R')
	exit(0)
if r == 1 and g == 1:
	print('B')
	exit(0)
if b > 1 and r == 1:
	print('GR')
	exit(0)
if b > 1 and g == 1:
	print('GR')
	exit(0)
if r > 1 and g == 1:
	print('BG')
	exit(0)
if r > 1 and b == 1:
	print('BG')
	exit(0)
if g > 1 and b == 1:
	print('BR')
	exit(0)
if g > 1 and r == 1:
	print('BR')
	exit(0)
print('BGR')


from collections import Counter
input()
F = Counter(input())
if len(F) < 2:
	print(*F)
elif len(F) > 2:
	print('BGR')
else:
	(f1, f2) = F.values()
	if f1 == f2 == 1:
		print((set('BGR') - set(F.keys())).pop())
	elif f1 > 1 and f2 > 1:
		print('BGR')
	else:
		print(*(c for c in 'BGR' if c not in F or F[c] == 1), sep='')


from collections import Counter
n = int(input())
s = input()
c = Counter(s)
(b, g, r) = (c['B'], c['G'], c['R'])
li = [c['B'], c['G'], c['R']]
zero = li.count(0)
if b > 0 and g > 0 and (r > 0):
	print('BGR')
elif zero == 2:
	for x in c:
		if c[x] != 0:
			print(x)
			break
elif b == 0:
	if g > 1 and r > 1:
		print('BGR')
	elif g == 1 and r > 1:
		print('BG')
	elif r == 1 and g > 1:
		print('BR')
	else:
		print('B')
elif g == 0:
	if b > 1 and r > 1:
		print('BGR')
	elif b == 1 and r > 1:
		print('BG')
	elif r == 1 and b > 1:
		print('GR')
	else:
		print('G')
elif r == 0:
	if g > 1 and b > 1:
		print('BGR')
	elif g == 1 and b > 1:
		print('GR')
	elif b == 1 and g > 1:
		print('BR')
	else:
		print('R')


n = int(input())
s = str(input())
t = 'BGR'
a = [s.count(c) for c in t]
rez = ''
for i in range(3):
	(x, y, z) = (a[i], a[(i + 1) % 3], a[(i + 2) % 3])
	if x >= 1 and y == z == 0 or (y >= 1 and z >= 1) or (x >= 1 and (y >= 2 or z >= 2)):
		rez += t[i]
print(rez)


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
d = [0, 0, 0]
dt = {0: 'B', 1: 'G', 2: 'R'}
n = ii()
s = si()
for i in s:
	if i == 'B':
		d[0] += 1
	elif i == 'G':
		d[1] += 1
	else:
		d[2] += 1
c0 = d.count(0)
c1 = d.count(1)
if c0 == 2:
	print(dt[d.index(max(d))])
elif c0 == 1 and c1 == 1:
	for i in range(3):
		if d[i] == 1 or d[i] == 0:
			print(dt[i], end='')
elif c1 == 2 and c0 == 1:
	print(dt[d.index(0)])
else:
	print('BGR')


def calc():
	n = int(input())
	deck = input()
	if len(set(deck)) == 1:
		print(deck[0])
		exit()
	if len(set(deck)) == 3:
		print('BGR')
		exit()
	r_count = deck.count('R')
	g_count = deck.count('G')
	b_count = deck.count('B')
	if r_count > 1 and b_count > 1 or (b_count > 1 and g_count > 1) or (g_count > 1 and r_count > 1):
		print('BGR')
		exit()
	if r_count == 1 and b_count == 1:
		print('G')
		exit()
	if g_count == 1 and r_count == 1:
		print('B')
		exit()
	if b_count == 1 and g_count == 1:
		print('R')
		exit()
	if r_count > 1 and b_count == 1:
		print('BG')
		exit()
	if r_count > 1 and g_count == 1:
		print('BG')
		exit()
	if g_count > 1 and r_count == 1:
		print('BR')
		exit()
	if g_count > 1 and b_count == 1:
		print('BR')
		exit()
	if b_count > 1 and g_count == 1:
		print('GR')
		exit()
	if b_count > 1 and r_count == 1:
		print('GR')
		exit()
calc()


def solve():
	n = int(input())
	s = input()
	cards = {'R': 0, 'G': 0, 'B': 0}
	for c in s:
		cards[c] += 1
	if cards['R'] > 0 and cards['G'] > 0 and (cards['B'] > 0):
		return 'BGR'
	if cards['R'] == 0 and cards['G'] == 0 or (cards['R'] == 0 and cards['B'] == 0) or (cards['G'] == 0 and cards['B'] == 0):
		if cards['R'] > 0:
			return 'R'
		if cards['G'] > 0:
			return 'G'
		return 'B'
	if cards['R'] == 0:
		if cards['G'] == cards['B'] == 1:
			return 'R'
		if cards['G'] > 1 and cards['B'] > 1:
			return 'BGR'
		if cards['G'] > cards['B']:
			return 'BR'
		return 'GR'
	if cards['G'] == 0:
		if cards['R'] == cards['B'] == 1:
			return 'G'
		if cards['R'] > 1 and cards['B'] > 1:
			return 'BGR'
		if cards['R'] > cards['B']:
			return 'BG'
		return 'GR'
	if cards['B'] == 0:
		if cards['R'] == cards['G'] == 1:
			return 'B'
		if cards['G'] > 1 and cards['R'] > 1:
			return 'BGR'
		if cards['R'] > cards['G']:
			return 'BG'
		return 'BR'
print(solve())


def R():
	return map(int, input().split())

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
from itertools import permutations
import bisect
l = I()
s = S()
cnt = Counter(s)
col = ['B', 'G', 'R']
cnt3 = sum([cnt[i] > 0 for i in col])
cnt2 = sum([cnt[i] > 1 for i in col])
if cnt3 == 3 or cnt2 >= 2:
	print('BGR')
	exit()
if cnt3 == 1:
	for i in col:
		if cnt[i] > 0:
			print(i, end='')
	exit()
if cnt3 == 2 and cnt2 == 1:
	for i in col:
		if cnt[i] < 2:
			print(i, end='')
	exit()
for i in col:
	if cnt[i] == 0:
		print(i, end='')


x = int(input())
y = input()
r = y.count('R')
g = y.count('G')
b = y.count('B')
if r >= 1 and g >= 1 and (b >= 1):
	print('BGR')
elif r >= 1 and g >= 1:
	if r == 1 and g == 1:
		print('B')
	elif r == 1:
		print('BR')
	elif g == 1:
		print('BG')
	else:
		print('BGR')
elif r >= 1 and b >= 1:
	if r == 1 and b == 1:
		print('G')
	elif r == 1:
		print('GR')
	elif b == 1:
		print('BG')
	else:
		print('BGR')
elif b >= 1 and g >= 1:
	if b == 1 and g == 1:
		print('R')
	elif b == 1:
		print('BR')
	elif g == 1:
		print('GR')
	else:
		print('BGR')
elif r >= 1:
	print('R')
elif g >= 1:
	print('G')
else:
	print('B')


input()
s = input()
rc = s.count('R')
gc = s.count('G')
bc = s.count('B')
rc = 2 if rc > 1 else rc
gc = 2 if gc > 1 else gc
bc = 2 if bc > 1 else bc
ans = ''
if gc == bc == 0 or gc * bc > 0 or (gc * bc == 0 and gc + bc > 1 and (rc > 0)):
	ans = ans + 'R'
if rc == bc == 0 or rc * bc > 0 or (rc * bc == 0 and rc + bc > 1 and (gc > 0)):
	ans = ans + 'G'
if gc == rc == 0 or gc * rc > 0 or (gc * rc == 0 and gc + rc > 1 and (bc > 0)):
	ans = ans + 'B'
print(''.join(sorted(set(ans))))


n = int(input())
s = input()
g = s.count('G')
b = s.count('B')
r = s.count('R')
if g != 0 and r != 0 and (b != 0):
	print('BGR')
elif g == 0 and r == 0:
	print('B')
elif g == 0 and b == 0:
	print('R')
elif b == 0 and r == 0:
	print('G')
elif g == 0:
	if r >= 2:
		print('B', end='')
	print('G', end='')
	if b >= 2:
		print('R', end='')
elif r == 0:
	if g >= 2:
		print('B', end='')
	if b >= 2:
		print('G', end='')
	print('R', end='')
elif b == 0:
	print('B', end='')
	if r >= 2:
		print('G', end='')
	if g >= 2:
		print('R', end='')


a = int(input())
s = input()
arr = [0, 0, 0]

def sum(arr):
	c = 0
	for i in arr:
		c += i
	return c

def determine(arr, poss, seen):
	if seen[arr[0]][arr[1]][arr[2]]:
		return poss[arr[0]][arr[1]][arr[2]]
	else:
		seen[arr[0]][arr[1]][arr[2]] = True
		if arr[0] >= 2:
			a = [arr[0] - 1, arr[1], arr[2]]
			p1 = determine(a, poss, seen)
			for i in range(3):
				if p1[i] == True:
					poss[arr[0]][arr[1]][arr[2]][i] = True
		if arr[1] >= 2:
			a = [arr[0], arr[1] - 1, arr[2]]
			p1 = determine(a, poss, seen)
			for i in range(3):
				if p1[i] == True:
					poss[arr[0]][arr[1]][arr[2]][i] = True
		if arr[2] >= 2:
			a = [arr[0], arr[1], arr[2] - 1]
			p1 = determine(a, poss, seen)
			for i in range(3):
				if p1[i] == True:
					poss[arr[0]][arr[1]][arr[2]][i] = True
		if arr[0] >= 1 and arr[1] >= 1:
			a = [arr[0] - 1, arr[1] - 1, arr[2] + 1]
			p1 = determine(a, poss, seen)
			for i in range(3):
				if p1[i] == True:
					poss[arr[0]][arr[1]][arr[2]][i] = True
		if arr[0] >= 1 and arr[2] >= 1:
			a = [arr[0] - 1, arr[1] + 1, arr[2] - 1]
			p1 = determine(a, poss, seen)
			for i in range(3):
				if p1[i] == True:
					poss[arr[0]][arr[1]][arr[2]][i] = True
		if arr[1] >= 1 and arr[2] >= 1:
			a = [arr[0] + 1, arr[1] - 1, arr[2] - 1]
			p1 = determine(a, poss, seen)
			for i in range(3):
				if p1[i] == True:
					poss[arr[0]][arr[1]][arr[2]][i] = True
		return poss[arr[0]][arr[1]][arr[2]]
for i in range(len(s)):
	if s[i] == 'B':
		arr[0] += 1
	elif s[i] == 'G':
		arr[1] += 1
	else:
		arr[2] += 1
b = arr[0]
g = arr[1]
r = arr[2]
a = [False, False, False]
if b > 0 and g > 0 and (r > 0):
	a = [True, True, True]
elif b == 0 and g == 0:
	a = [False, False, True]
elif b == 0 and r == 0:
	a = [False, True, False]
elif g == 0 and r == 0:
	a = [True, False, False]
elif b == 0:
	if g > 1 and r > 1:
		a = [True, True, True]
	elif g == 1 and r > 1:
		a = [True, True, False]
	elif r == 1 and g > 1:
		a = [True, False, True]
	else:
		a = [True, False, False]
elif g == 0:
	if b > 1 and r > 1:
		a = [True, True, True]
	elif b == 1 and r > 1:
		a = [True, True, False]
	elif r == 1 and b > 1:
		a = [False, True, True]
	else:
		a = [False, True, False]
elif r == 0:
	if g > 1 and b > 1:
		a = [True, True, True]
	elif g == 1 and b > 1:
		a = [False, True, True]
	elif b == 1 and g > 1:
		a = [True, False, True]
	else:
		a = [False, False, True]
else:
	seen = [[[False for i in range(r + g + b + 1)] for i in range(r + g + b + 1)] for i in range(r + g + b + 1)]
	seen[0][0][0] = True
	poss = [[[[False, False, False] for i in range(r + g + b + 1)] for i in range(r + g + b + 1)] for i in range(r + g + b + 1)]
	poss[0][0][0] = [False, False, False]
	seen[1][0][0] = True
	poss[1][0][0][0] = True
	seen[0][1][0] = True
	poss[0][1][0][1] = True
	seen[0][0][1] = True
	poss[0][0][1][2] = True
	a = determine(arr, poss, seen)
t = ''
if a[0] == True:
	t += 'B'
if a[1] == True:
	t += 'G'
if a[2] == True:
	t += 'R'
print(t)


input()
s = str(input())
r = s.count('R')
b = s.count('B')
g = s.count('G')
if r >= 1 and b >= 1 and (g >= 1) or (r >= 2 and b >= 2 and (g == 0)) or (r == 0 and b >= 2 and (g >= 2)) or (r >= 2 and b == 0 and (g >= 2)):
	print('BGR')
if r >= 1 and b == 0 and (g == 0) or (r == 0 and b == 1 and (g == 1)):
	print('R')
if r == 0 and b >= 1 and (g == 0) or (r == 1 and b == 0 and (g == 1)):
	print('B')
if r == 0 and b == 0 and (g >= 1) or (r == 1 and b == 1 and (g == 0)):
	print('G')
if r >= 2 and b == 1 and (g == 0) or (r >= 2 and b == 0 and (g == 1)):
	print('BG')
if r == 0 and b >= 2 and (g == 1) or (r == 1 and b >= 2 and (g == 0)):
	print('GR')
if r == 0 and b == 1 and (g >= 2) or (r == 1 and b == 0 and (g >= 2)):
	print('BR')


def ans(RGB):
	if RGB['B'] > 0 and RGB['G'] > 0 and (RGB['R'] > 0):
		return 'BGR'
	elif RGB['B'] > 1 and RGB['G'] > 1:
		RGB['B'] -= 1
		RGB['G'] -= 1
		RGB['R'] += 1
		return ans(RGB)
	elif RGB['G'] > 1 and RGB['R'] > 1:
		RGB['B'] += 1
		RGB['G'] -= 1
		RGB['R'] -= 1
		return ans(RGB)
	elif RGB['B'] > 1 and RGB['R'] > 1:
		RGB['B'] -= 1
		RGB['G'] += 1
		RGB['R'] -= 1
		return ans(RGB)
	elif RGB['B'] == 1 and RGB['G'] == 1:
		RGB['B'] -= 1
		RGB['G'] -= 1
		RGB['R'] += 1
		return ans(RGB)
	elif RGB['G'] == 1 and RGB['R'] == 1:
		RGB['B'] += 1
		RGB['G'] -= 1
		RGB['R'] -= 1
		return ans(RGB)
	elif RGB['B'] == 1 and RGB['R'] == 1:
		RGB['B'] -= 1
		RGB['G'] += 1
		RGB['R'] -= 1
		return ans(RGB)
	elif RGB['B'] > 0 and RGB['G'] > 0:
		if RGB['B'] == 1:
			return 'BR'
		else:
			return 'GR'
	elif RGB['G'] > 0 and RGB['R'] > 0:
		if RGB['G'] == 1:
			return 'BG'
		else:
			return 'BR'
	elif RGB['B'] > 0 and RGB['R'] > 0:
		if RGB['B'] == 1:
			return 'BG'
		else:
			return 'GR'
	elif RGB['B'] > 0:
		return 'B'
	elif RGB['G'] > 0:
		return 'G'
	elif RGB['R'] > 0:
		return 'R'
n = int(input())
RGB = dict()
RGB['R'] = 0
RGB['G'] = 0
RGB['B'] = 0
for e in input():
	RGB[e] += 1
print(ans(RGB))


n = int(input())
st = input()
if len(set(st)) == 1:
	print(st[0])
elif len(set(st)) == 3:
	print('BGR')
else:
	r = st.count('R')
	g = st.count('G')
	b = st.count('B')
	if 'R' in st and 'B' in st:
		if r >= 2 and b >= 2:
			print('BGR')
		elif r >= 2 and b < 2:
			print('BG')
		elif r < 2 and b >= 2:
			print('GR')
		else:
			print('G')
	if 'R' in st and 'G' in st:
		if r >= 2 and g >= 2:
			print('BGR')
		elif r >= 2 and g < 2:
			print('BG')
		elif r < 2 and g >= 2:
			print('BR')
		else:
			print('B')
	if 'G' in st and 'B' in st:
		if g >= 2 and b >= 2:
			print('BGR')
		elif g >= 2 and b < 2:
			print('BR')
		elif g < 2 and b >= 2:
			print('GR')
		else:
			print('R')


n = int(input())
s = input()
colors = 'BGR'
cnt = [(s.count('B'), 0), (s.count('G'), 1), (s.count('R'), 2)]
cnt.sort()
if cnt[0][0] >= 1 or cnt[1][0] >= 2:
	print(colors)
elif cnt[1][0] == 0:
	print(colors[cnt[2][1]])
elif cnt[1][0] == 1 and cnt[2][0] == 1:
	print(colors[cnt[0][1]])
elif colors[cnt[0][1]] < colors[cnt[1][1]]:
	print(colors[cnt[0][1]] + colors[cnt[1][1]])
else:
	print(colors[cnt[1][1]] + colors[cnt[0][1]])


n = int(input())
s = str(input())
if s.count('R') == 0 and s.count('B') == 0 or (s.count('R') == 0 and s.count('G') == 0) or (s.count('B') == 0 and s.count('G') == 0):
	if s.count('R') != 0:
		print('R')
	elif s.count('B') != 0:
		print('B')
	else:
		print('G')
elif s.count('G') == 0 or s.count('B') == 0 or s.count('R') == 0:
	if s.count('R') == 0:
		if s.count('G') == 1 and s.count('B') == 1:
			print('R')
		elif s.count('G') == 1 and s.count('B') != 1:
			print('GR')
		elif s.count('G') != 1 and s.count('B') == 1:
			print('BR')
		else:
			print('BGR')
	elif s.count('B') == 0:
		if s.count('R') == 1 and s.count('G') == 1:
			print('B')
		elif s.count('R') == 1 and s.count('G') != 1:
			print('BR')
		elif s.count('R') != 1 and s.count('G') == 1:
			print('BG')
		else:
			print('BGR')
	elif s.count('R') == 1 and s.count('B') == 1:
		print('G')
	elif s.count('R') == 1 and s.count('B') != 1:
		print('GR')
	elif s.count('R') != 1 and s.count('B') == 1:
		print('BG')
	else:
		print('BGR')
else:
	print('BGR')


from collections import Counter
ALL_CARDS = set('RGB')

def solve():
	length = int(input().strip())
	cards = input().strip()
	counter = Counter(cards)
	card_counts = dict(counter.most_common())
	available_cards = set(card_counts.keys())
	missing_cards = ALL_CARDS - available_cards
	more_than_1s = set([card for card in available_cards if card_counts[card] > 1])
	candidate = None
	if len(available_cards) == 3:
		candidate = ALL_CARDS
	elif len(available_cards) == 1:
		candidate = available_cards
	elif len(more_than_1s) == 2:
		candidate = ALL_CARDS
	elif len(more_than_1s) == 1:
		candidate = ALL_CARDS - more_than_1s
	else:
		candidate = missing_cards
	print(''.join(sorted(candidate)))
solve()


n = int(input())
s = input()
(b, g, r) = (0, 0, 0)
for i in range(0, len(s)):
	if s[i] == 'B':
		b += 1
	elif s[i] == 'G':
		g += 1
	elif s[i] == 'R':
		r += 1
	else:
		assert False
if b != 0 and g == 0 and (r == 0) or (b == 0 and g == 1 and (r == 1)):
	print('B')
elif b == 0 and g != 0 and (r == 0) or (b == 1 and g == 0 and (r == 1)):
	print('G')
elif b == 0 and g == 0 and (r != 0) or (b == 1 and g == 1 and (r == 0)):
	print('R')
elif b > 1 and g == 1 and (r == 0) or (b > 1 and g == 0 and (r == 1)):
	print('GR')
elif b == 0 and g > 1 and (r == 1) or (b == 1 and g > 1 and (r == 0)):
	print('BR')
elif b == 0 and g == 1 and (r > 1) or (b == 1 and g == 0 and (r > 1)):
	print('BG')
else:
	print('BGR')


from collections import defaultdict

def main():
	n = int(input())
	s = input()
	r = g = b = 0
	rp = gp = bp = 0
	for i in range(n):
		if s[i] == 'R':
			r += 1
			rp = 1
		elif s[i] == 'G':
			g += 1
			gp = 1
		else:
			b += 1
			bp = 1
	score = rp + gp + bp
	total = r + g + b
	if score == 3:
		print('BGR')
	elif score == 1:
		if rp > 0:
			print('R')
		elif gp > 0:
			print('G')
		else:
			print('B')
	elif rp == 0:
		if total > 3:
			if g > 1 and b > 1:
				print('BGR')
			elif g > 1 and b == 1:
				print('BR')
			else:
				print('GR')
		elif total == 2:
			print('R')
		elif b == 2:
			print('GR')
		else:
			print('BR')
	elif gp == 0:
		if total > 3:
			if r > 1 and b > 1:
				print('BGR')
			elif r > 1 and b == 1:
				print('BG')
			else:
				print('GR')
		elif total == 2:
			print('G')
		elif b == 2:
			print('GR')
		else:
			print('BG')
	elif total > 3:
		if r > 1 and g > 1:
			print('BGR')
		elif r > 1 and g == 1:
			print('BG')
		else:
			print('BR')
	elif total == 2:
		print('B')
	elif g == 2:
		print('BR')
	else:
		print('BG')
main()


import os
import sys
from io import BytesIO, IOBase

def main():
	n = int(input())
	l = list(input())
	s = set(l)
	if len(s) == 3:
		print('BGR')
	elif len(s) == 1:
		print(l[0])
	else:
		x = l.count('R')
		y = l.count('G')
		z = l.count('B')
		if not x:
			if y == 1 and z == 1:
				print('R')
			elif y > 1 and z > 1:
				print('BGR')
			elif y == 1:
				print('GR')
			else:
				print('BR')
		elif not y:
			if x == 1 and z == 1:
				print('G')
			elif x > 1 and z > 1:
				print('BGR')
			elif x == 1:
				print('GR')
			else:
				print('BG')
		elif x == 1 and y == 1:
			print('B')
		elif y > 1 and x > 1:
			print('BGR')
		elif x == 1:
			print('BR')
		else:
			print('BG')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


class CodeforcesTask626BSolution:

	def __init__(self):
		self.result = ''
		self.n = 0
		self.cards = []

	def read_input(self):
		self.n = int(input())
		self.cards = input()

	def process_task(self):
		cards_cnt = [self.cards.count(x) for x in 'BGR']
		to_consider = [cards_cnt]
		results = [0, 0, 0]
		considered = []
		while to_consider and sum(results) < 3:
			considering = to_consider.pop(-1)
			considered.append(considering)
			if sum(considering) > 1:
				if considering[0] and considering[1]:
					variant = considering[:]
					variant[0] -= 1
					variant[1] -= 1
					variant[2] += 1
					if variant not in considered:
						to_consider.append(variant)
				if considering[0] and considering[2]:
					variant = considering[:]
					variant[0] -= 1
					variant[2] -= 1
					variant[1] += 1
					if variant not in considered:
						to_consider.append(variant)
				if considering[1] and considering[2]:
					variant = considering[:]
					variant[2] -= 1
					variant[1] -= 1
					variant[0] += 1
					if variant not in considered:
						to_consider.append(variant)
				if considering[0] > 1:
					variant = considering[:]
					variant[0] -= 1
					if variant not in considered:
						to_consider.append(variant)
				if considering[1] > 1:
					variant = considering[:]
					variant[1] -= 1
					if variant not in considered:
						to_consider.append(variant)
				if considering[2] > 1:
					variant = considering[:]
					variant[2] -= 1
					if variant not in considered:
						to_consider.append(variant)
			elif considering[0]:
				results[0] = 1
			elif considering[1]:
				results[1] = 1
			else:
				results[2] = 1
		if results[0]:
			self.result += 'B'
		if results[1]:
			self.result += 'G'
		if results[2]:
			self.result += 'R'

	def get_result(self):
		return self.result
Solution = CodeforcesTask626BSolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = int(input())
cards = input()
r_count = ('R', cards.count('R'))
g_count = ('G', cards.count('G'))
b_count = ('B', cards.count('B'))
r = 'RGB'
a = [r_count, g_count, b_count]
a.sort(key=lambda item: item[1])
if a[0][1] == 0:
	if a[1][1] == 0:
		r = a[2][0]
	elif a[1][1] != a[2][1] and a[1][1] == 1:
		r = a[1][0] + a[0][0]
	elif a[1][1] == 1:
		r = a[0][0]
print(''.join(sorted(r)))


n = int(input())
a = input()
g = a.count('G')
b = a.count('B')
r = a.count('R')
amm = b + r + g
am = 0
if b != 0:
	am += 1
if g != 0:
	am += 1
if r != 0:
	am += 1
if am == 1:
	if b != 0:
		print('B')
	if g != 0:
		print('G')
	if r != 0:
		print('R')
elif am == 3:
	print('BGR')
elif am == amm:
	if g == 0:
		print('G')
	elif b == 0:
		print('B')
	else:
		print('R')
elif g == 1:
	if b == 0:
		print('BG')
	else:
		print('GR')
elif b == 1:
	if g == 0:
		print('BG')
	else:
		print('BR')
elif r == 1:
	if g == 0:
		print('GR')
	else:
		print('BR')
else:
	print('BGR')


class Solution:

	def __init__(self):
		self.green_possible = 0
		self.red_possible = 0
		self.blue_possible = 0
		self.cache = []

	def main(self):
		input()
		colors = input()
		reds = 0
		blues = 0
		greens = 0
		for i in colors:
			if i == 'R':
				reds += 1
			elif i == 'B':
				blues += 1
			else:
				greens += 1
		self.solve(reds, greens, blues)
		ans = ''
		if self.blue_possible:
			ans += 'B'
		if self.green_possible:
			ans += 'G'
		if self.red_possible:
			ans += 'R'
		print(ans)

	def solve(self, reds, greens, blues):
		stri = str(reds) + str(greens) + str(blues)
		if stri in self.cache:
			return
		self.cache.append(stri)
		if self.blue_possible == 1 and self.green_possible == 1 and (self.red_possible == 1):
			return
		if reds == 1 and greens == 1 and (blues == 0):
			self.blue_possible = 1
			return
		elif reds == 1 and greens == 0 and (blues == 1):
			self.green_possible = 1
			return
		elif reds == 0 and greens == 1 and (blues == 1):
			self.red_possible = 1
		elif reds == 0 and greens == 0 and (blues == 1):
			self.blue_possible = 1
			return
		elif reds == 0 and greens == 1 and (blues == 0):
			self.green_possible = 1
			return
		elif reds == 1 and greens == 0 and (blues == 0):
			self.red_possible = 1
			return
		else:
			if blues >= 2:
				self.solve(reds, greens, blues - 1)
			if reds >= 2:
				self.solve(reds - 1, greens, blues)
			if greens >= 2:
				self.solve(reds, greens - 1, blues)
			if reds >= 1 and blues >= 1:
				self.solve(reds - 1, greens + 1, blues - 1)
			if greens >= 1 and blues >= 1:
				self.solve(reds + 1, greens - 1, blues - 1)
			if reds >= 1 and greens >= 1:
				self.solve(reds - 1, greens - 1, blues + 1)
solution = Solution()
solution.main()


from collections import defaultdict

def mp():
	return map(int, input().split())

def lt():
	return list(map(int, input().split()))

def pt(x):
	print(x)

def ip():
	return input()

def it():
	return int(input())

def sl(x):
	return [t for t in x]

def spl(x):
	return x.split()

def aj(liste, item):
	liste.append(item)

def bin(x):
	return '{0:b}'.format(x)

def printlist(l):
	print(''.join([str(x) for x in l]))

def listring(l):
	return ''.join([str(x) for x in l])
n = it()
s = [x for x in input()]
t = 'RGB'
c = [s.count(t[i]) for i in range(3)]
res = []
for i in range(3):
	(x, y, z) = (c[i], c[(i + 1) % 3], c[(i + 2) % 3])
	if x >= 1 and y == z == 0 or (y >= 1 and z >= 1) or (x >= 1 and (y >= 2 or z >= 2)):
		res += t[i]
res.sort()
printlist(res)


n = int(input())
s = input().strip()
if 'R' in s and 'G' in s and ('B' in s):
	ans = 'RGB'
elif 'R' in s and 'G' in s:
	a = 'R'
	b = 'G'
	c = 'B'
	if s.count(a) > 1 and s.count(b) > 1:
		ans = 'RGB'
	elif n == 2:
		ans = c
	elif s.count(a) > s.count(b):
		ans = b + c
	else:
		ans = a + c
elif 'R' in s and 'B' in s:
	a = 'R'
	c = 'G'
	b = 'B'
	if s.count(a) > 1 and s.count(b) > 1:
		ans = 'RGB'
	elif n == 2:
		ans = c
	elif s.count(a) > s.count(b):
		ans = b + c
	else:
		ans = a + c
elif 'G' in s and 'B' in s:
	c = 'R'
	a = 'G'
	b = 'B'
	if s.count(a) > 1 and s.count(b) > 1:
		ans = 'RGB'
	elif n == 2:
		ans = c
	elif s.count(a) > s.count(b):
		ans = b + c
	else:
		ans = a + c
else:
	ans = s[0]
ret = []
for char in ans:
	ret.append(char)
ret.sort()
print(''.join(ret))


from sys import stdin
import sys
n = int(stdin.readline().strip())
s = stdin.readline().strip()
g = 0
r = 0
b = 0
for i in s:
	if i == 'R':
		r += 1
	elif i == 'G':
		g += 1
	else:
		b += 1
if r == 0 and g == 0:
	print('B')
	sys.exit()
if b == 0 and r == 0:
	print('G')
	sys.exit()
if b == 0 and g == 0:
	print('R')
	sys.exit()
if b > 0 and r > 0 and (g > 0) or (b > 1 and r > 1) or (b > 1 and g > 1) or (r > 1 and g > 1):
	print('BGR')
	sys.exit()
if b > 1 and (r == 1 or g == 1):
	print('GR')
	sys.exit()
if r > 1 and (b == 1 or g == 1):
	print('BG')
	sys.exit()
if g > 1 and (r == 1 or b == 1):
	print('BR')
	sys.exit()
if r == 1 and g == 1:
	print('B')
	sys.exit()
if g == 1 and b == 1:
	print('R')
	sys.exit()
if r == 1 and b == 1:
	print('G')
	sys.exit()


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
n = iinp()
r = g = b = 0
s = inp()
cnt = l1d(3)
t = 'BGR'
for c in s:
	cnt[t.index(c)] += 1
cnt = [(cnt[i], t[i]) for i in range(3)]
cnt.sort()
if not cnt[1][0]:
	print(cnt[2][1])
elif cnt[0][0] >= 1 or cnt[1][0] >= 2:
	print('BGR')
elif cnt[0][0] == cnt[1][0] == 1:
	print(cnt[2][1])
elif cnt[1][0] == cnt[2][0] == 1:
	print(cnt[0][1])
else:
	print(''.join(sorted([cnt[0][1], cnt[1][1]])))


n = int(input())
s = str(input())
if n == 1:
	print(s)
elif n == 2:
	if s == 'RG' or s == 'GR' or s == 'BB':
		print('B')
	if s == 'BG' or s == 'GB' or s == 'RR':
		print('R')
	if s == 'RB' or s == 'BR' or s == 'GG':
		print('G')
elif s.count('R') == n:
	print('R')
elif s.count('B') == n:
	print('B')
elif s.count('G') == n:
	print('G')
elif s.count('R') == 0 and s.count('G') == 1:
	print('GR')
elif s.count('G') == 0 and s.count('B') == 1:
	print('BG')
elif s.count('B') == 0 and s.count('G') == 1:
	print('BG')
elif s.count('R') == 0 and s.count('B') == 1:
	print('BR')
elif s.count('G') == 0 and s.count('R') == 1:
	print('GR')
elif s.count('B') == 0 and s.count('R') == 1:
	print('BR')
else:
	print('BGR')


import collections
import math
n = int(input())
s = input()
(a, b, c) = (s.count('B'), s.count('G'), s.count('R'))
if a * b * c != 0 or (a >= 2 and b >= 2) or (a >= 2 and c >= 2) or (c >= 2 and b >= 2):
	print('BGR')
elif a != 0 and b == 0 and (c == 0):
	print('B')
elif a == 0 and b != 0 and (c == 0):
	print('G')
elif a == 0 and b == 0 and (c != 0):
	print('R')
elif a == 0:
	if b == c:
		print('B')
	elif b > c:
		print('BR')
	else:
		print('BG')
elif b == 0:
	if a == c:
		print('G')
	elif a > c:
		print('GR')
	else:
		print('BG')
elif c == 0:
	if b == a:
		print('R')
	elif b > a:
		print('BR')
	else:
		print('GR')


n = input()
ch = input()
g = ch.count('G')
r = ch.count('R')
b = ch.count('B')
if g and r and b:
	print('BGR')
elif g > 1 and r > 1:
	print('BGR')
elif g > 1 and b > 1:
	print('BGR')
elif r > 1 and b > 1:
	print('BGR')
elif g == 1 and r > 1:
	print('BG')
elif g == 1 and b > 1:
	print('GR')
elif r == 1 and b > 1:
	print('GR')
elif r == 1 and g > 1:
	print('BR')
elif b == 1 and r > 1:
	print('BG')
elif b == 1 and g > 1:
	print('BR')
elif g == 1 and r == 1:
	print('B')
elif g == 1 and b == 1:
	print('R')
elif r == 1 and b == 1:
	print('G')
elif r:
	print('R')
elif b:
	print('B')
elif g:
	print('G')


n = input()
s = input()
arr = ['B', 'G', 'R']
cnt = (s.count('B'), s.count('G'), s.count('R'))
zeros = 0
can = [False, False, False]
for i in cnt:
	if i == 0:
		zeros += 1
if zeros == 0:
	can = [True, True, True]
elif zeros == 2:
	for i in range(3):
		if cnt[i] != 0:
			can[i] = True
else:
	sum = 0
	for i in range(3):
		sum += cnt[i]
	for i in range(3):
		can[i] = cnt[i] != sum - 1
for i in range(3):
	if can[i]:
		print(arr[i], end='')


import sys
inf = float('inf')
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
(mod, MOD) = (1000000007, 998244353)
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
string = input()
mydict = dict()
for i in string:
	mydict[i] = mydict.get(i, 0) + 1
if len(mydict) == 3:
	print('BGR')
elif len(mydict) == 1:
	print(string[0])
elif len(mydict) == 2:
	mylist = []
	for i in string:
		mylist.append(i)
	mylist.sort()
	first = mylist[0]
	second = mylist[-1]
	little = 'BGR'
	if mydict[first] == 1 and mydict[second] == 1:
		for i in little:
			if i != first and i != second:
				print(i)
				exit()
	elif mydict[first] == 1 and mydict[second] > 1:
		ans = ''
		for i in little:
			if i != second:
				ans += i
		print(ans)
	elif mydict[first] > 1 and mydict[second] == 1:
		ans = ''
		for i in little:
			if i != first:
				ans += i
		print(ans)
	elif mydict[first] > 1 and mydict[second] > 1:
		print(little)


def main():
	n = int(input())
	q = str(input())
	d = [0] * 3
	for e in q:
		if e == 'B':
			d[0] += 1
		elif e == 'G':
			d[1] += 1
		else:
			d[2] += 1
	answer = ''
	if d[0] != 0 and d[1] != 0:
		answer += 'R'
		if d[0] > 1:
			answer += 'G'
		if d[1] > 1:
			answer += 'B'
	if d[0] != 0 and d[2] != 0:
		answer += 'G'
		if d[0] > 1:
			answer += 'R'
		if d[2] > 1:
			answer += 'B'
	if d[1] != 0 and d[2] != 0:
		answer += 'B'
		if d[1] > 1:
			answer += 'R'
		if d[2] > 1:
			answer += 'G'
	if d[0] > 0 and d[1] == 0 and (d[2] == 0):
		answer += 'B'
	if d[1] > 0 and d[0] == 0 and (d[2] == 0):
		answer += 'G'
	if d[2] > 0 and d[0] == 0 and (d[1] == 0):
		answer += 'R'
	q = ''
	for e in sorted(list(set(answer))):
		q += e
	print(q)

def __starting_point():
	main()
__starting_point()


def main():
	n = int(input())
	s = input()
	(b, g, r) = [s.count(i) for i in 'BGR']
	if min(b, g, r) > 0:
		print('BGR')
		return
	if max(b, g, r) == n:
		if b == n:
			print('B')
		if g == n:
			print('G')
		if r == n:
			print('R')
		return
	if max(b, g, r) == 1:
		if b == 0:
			print('B')
		if g == 0:
			print('G')
		if r == 0:
			print('R')
		return
	if max(b, g, r) == n - 1:
		if b == n - 1:
			print('GR')
		if g == n - 1:
			print('BR')
		if r == n - 1:
			print('BG')
		return
	print('BGR')
main()


input()
s = input()
t = set(s)
if len(t) == 1:
	print(s[0])
elif len(t) == 3:
	print('BGR')
else:
	(a, b) = t
	(x, y) = (s.count(a), s.count(b))
	if x == 1 and y == 1:
		print('BGR'.strip(a + b))
	elif x == 1 and y > 1:
		for i in 'BGR':
			if i != b:
				print(i, end='')
	elif x > 1 and y == 1:
		for i in 'BGR':
			if i != a:
				print(i, end='')
	else:
		print('BGR')


n = int(input())
s = input()
d = {'B': 0, 'G': 0, 'R': 0}
for c in s:
	d[c] += 1
vl = d.values()
b = max(vl)
s = min(vl)
ss = sum(vl)
if s > 0 or (b != ss and ss - b > 1):
	f = 'BGR'
elif b == ss:
	f = max(d, key=d.get)
elif ss == 2 and b == 1:
	f = min(d, key=d.get)
else:
	f = ''.join([k for k in d if d[k] != b])
print(f)


n = int(input())
s = input()
if s.count('R') and s.count('G') and s.count('B'):
	print('BGR')
elif s.count('R') and (not s.count('G')) and (not s.count('B')):
	print('R')
elif not s.count('R') and (not s.count('G')) and s.count('B'):
	print('B')
elif not s.count('R') and s.count('G') and (not s.count('B')):
	print('G')
elif s.count('R') and s.count('G') and (not s.count('B')):
	if s.count('R') == 1 and s.count('G') == 1:
		print('B')
	elif s.count('R') == 1 and s.count('G') > 1:
		print('BR')
	elif s.count('R') > 1 and s.count('G') == 1:
		print('BG')
	else:
		print('BGR')
elif s.count('R') and (not s.count('G')) and s.count('B'):
	if s.count('R') == 1 and s.count('B') == 1:
		print('G')
	elif s.count('R') == 1 and s.count('B') > 1:
		print('GR')
	elif s.count('R') > 1 and s.count('B') == 1:
		print('BG')
	else:
		print('BGR')
elif not s.count('R') and s.count('G') and s.count('B'):
	if s.count('B') == 1 and s.count('G') == 1:
		print('R')
	elif s.count('B') == 1 and s.count('G') > 1:
		print('BR')
	elif s.count('B') > 1 and s.count('G') == 1:
		print('GR')
	else:
		print('BGR')


from sys import stdin, stdout
n = int(stdin.readline())
s = stdin.readline()[:-1]
c1 = 0
c2 = 0
c3 = 0
for i in s:
	if i == 'R':
		c1 += 1
	elif i == 'B':
		c2 += 1
	else:
		c3 += 1
if c1 > 0 and c2 > 0 and (c3 > 0) or (c1 > 1 and c2 > 1) or (c1 > 1 and c3 > 1) or (c2 > 1 and c3 > 1):
	print('BGR')
elif c1 > 0:
	if c2 > 1:
		print('GR')
	elif c3 > 1:
		print('BR')
	elif (c2 == 1 or c3 == 1) and c1 > 1:
		print('BG')
	elif c2 == 1 and c1 == 1:
		print('G')
	elif c1 == 1 and c3 == 1:
		print('B')
	else:
		print('R')
elif c2 > 0:
	if c3 > 1:
		print('BR')
	elif c2 > 1 and c3 == 1:
		print('GR')
	elif c2 == 1 and c3 == 1:
		print('R')
	else:
		print('B')
else:
	print('G')


from copy import deepcopy
n = int(input())
d = dict()
d['R'] = 0
d['G'] = 0
d['B'] = 0
s = input()
for i in s:
	d[i] += 1
if d['R'] >= 1 and d['G'] >= 1 and (d['B'] >= 1):
	print('BGR')
elif d['R'] == 0 and d['B'] != 0 and (d['G'] != 0):
	if d['B'] == 1 and d['G'] == 1:
		print('R')
	elif d['B'] > 1 and d['G'] == 1:
		print('GR')
	elif d['B'] == 1 and d['G'] > 1:
		print('BR')
	else:
		print('BGR')
elif d['B'] == 0 and d['R'] != 0 and (d['G'] != 0):
	if d['R'] == 1 and d['G'] == 1:
		print('B')
	elif d['R'] > 1 and d['G'] == 1:
		print('BG')
	elif d['R'] == 1 and d['G'] > 1:
		print('BR')
	else:
		print('BGR')
elif d['G'] == 0 and d['R'] != 0 and (d['B'] != 0):
	if d['R'] == 1 and d['B'] == 1:
		print('G')
	elif d['R'] > 1 and d['B'] == 1:
		print('BG')
	elif d['R'] == 1 and d['B'] > 1:
		print('GR')
	else:
		print('BGR')
elif d['B'] == 0 and d['R'] == 0:
	print('G')
elif d['R'] == 0 and d['G'] == 0:
	print('B')
elif d['G'] == 0 and d['B'] == 0:
	print('R')


n = int(input())
s = input()
blue = 0
red = 0
green = 0
for i in range(n):
	if s[i] == 'B':
		blue += 1
	elif s[i] == 'R':
		red += 1
	else:
		green += 1
if red >= 1 and blue >= 1 and (green >= 1):
	print('BGR')
elif red > 1 and blue > 1 or (red > 1 and green > 1) or (green > 1 and blue > 1):
	print('BGR')
elif red == 0 and blue == 0:
	print('G')
elif red == 0 and green == 0:
	print('B')
elif blue == 0 and green == 0:
	print('R')
elif red == 1 and blue > 1:
	print('GR')
elif red == 1 and green > 1:
	print('BR')
elif blue == 1 and red > 1:
	print('BG')
elif blue == 1 and green > 1:
	print('BR')
elif green == 1 and red > 1:
	print('BG')
elif green == 1 and blue > 1:
	print('GR')
elif red == 1 and blue == 1:
	print('G')
elif red == 1 and green == 1:
	print('B')
elif blue == 1 and red == 1:
	print('G')
elif blue == 1 and green == 1:
	print('R')
elif green == 1 and red == 1:
	print('B')
elif green == 1 and blue == 1:
	print('R')


n = int(input())
s = input()
if 'R' in s and 'G' in s and ('B' in s):
	print('BGR')
	return
if 'R' not in s and 'G' not in s:
	print('B')
	return
if 'R' not in s and 'B' not in s:
	print('G')
	return
if 'B' not in s and 'G' not in s:
	print('R')
	return
if 'R' in s and 'G' in s:
	answer = 'B'
	if s.count('R') > 1:
		answer += 'G'
	if s.count('G') > 1:
		answer += 'R'
	print(answer)
	return
if 'R' in s and 'B' in s:
	answer = 'G'
	if s.count('R') > 1:
		answer = 'B' + answer
	if s.count('B') > 1:
		answer += 'R'
	print(answer)
	return
if 'B' in s and 'G' in s:
	answer = 'R'
	if s.count('B') > 1:
		answer = 'G' + answer
	if s.count('G') > 1:
		answer = 'B' + answer
	print(answer)
	return


import sys

def scan(TYPE_1, TYPE_2=0):
	if TYPE_1 == int:
		return map(int, sys.stdin.readline().strip().split())
	elif TYPE_1 == float:
		return map(float, sys.stdin.readline().strip().split())
	elif TYPE_1 == list and TYPE_2 == float:
		return list(map(float, sys.stdin.readline().strip().split()))
	elif TYPE_1 == list and TYPE_2 == int:
		return list(map(int, sys.stdin.readline().strip().split()))
	elif TYPE_1 == str:
		return sys.stdin.readline().strip()
	else:
		print('ERROR!!!!')

def main():
	n = int(scan(str))
	s = scan(str)
	mp = {'B': 0, 'G': 0, 'R': 0}
	for i in range(n):
		mp[s[i]] += 1
	if mp['B'] == n or (mp['G'] > 0 and mp['R'] > 0) or (mp['B'] > 0 and (mp['G'] > 1 or mp['R'] > 1)):
		print('B', end='')
	if mp['G'] == n or (mp['B'] > 0 and mp['R'] > 0) or (mp['G'] > 0 and (mp['B'] > 1 or mp['R'] > 1)):
		print('G', end='')
	if mp['R'] == n or (mp['G'] > 0 and mp['B'] > 0) or (mp['R'] > 0 and (mp['G'] > 1 or mp['B'] > 1)):
		print('R', end='')
main()


n = int(input())
c = (lambda s: {(s.count(color), color) for color in 'BGR' if s.count(color)})(input())
if len(c) == 3 or (len(c) == 2 and min(c)[0] > 1):
	print('BGR')
elif len(c) == 1:
	print(min(c)[1])
elif max(c)[0] > 1:
	print(*sorted(set('BGR') - {max(c)[1]}), sep='')
else:
	print(*set('BGR') - {x[1] for x in c})


def main():
	n = int(input())
	s = input()
	r = g = b = 0
	for c in s:
		if c == 'R':
			r += 1
		elif c == 'G':
			g += 1
		else:
			b += 1
	ss = r + g + b
	l = [(r, 'R'), (g, 'G'), (b, 'B')]
	l.sort()
	(l1, l2, l3) = l
	(c1, s1) = l1
	(c2, s2) = l2
	(c3, s3) = l3
	if c2 == 0:
		s = [s3]
	elif c1 == 0:
		if c2 == 1:
			if c3 == 1:
				s = [s1]
			else:
				s = [s1, s2]
		else:
			s = [s1, s2, s3]
	else:
		s = [s1, s2, s3]
	s.sort()
	print(''.join(s))
main()


n = int(input())
s = input()
b = 'B' in s
g = 'G' in s
r = 'R' in s
if b + g + r == 3:
	print('BGR')
elif b + g + r == 1:
	print(s[0])
elif b + g + r == 2:
	e = ['B', 'G', 'R']
	if s.count('B') == len(s) - 1:
		e.remove('B')
	if s.count('G') == len(s) - 1:
		e.remove('G')
	if s.count('R') == len(s) - 1:
		e.remove('R')
	for i in range(len(e)):
		print(e[i], end='')


input()
cards = list(input())
(r, g, b) = (0, 0, 0)
for card in cards:
	if card == 'R':
		r += 1
	elif card == 'G':
		g += 1
	else:
		b += 1
if r == 0 and g == 0 or (r, g, b) == (1, 1, 0):
	print('B')
elif r == 0 and b == 0 or (r, g, b) == (1, 0, 1):
	print('G')
elif b == 0 and g == 0 or (r, g, b) == (0, 1, 1):
	print('R')
elif (r, g, b) == (1, g, 0) or (r, g, b) == (0, g, 1):
	print('BR')
elif (r, g, b) == (r, 1, 0) or (r, g, b) == (r, 0, 1):
	print('BG')
elif (r, g, b) == (1, 0, b) or (r, g, b) == (0, 1, b):
	print('GR')
else:
	print('BGR')


n = int(input())
s = str(input())
num_R = 0
num_B = 0
num_G = 0
elements = set()
for char in s:
	if char == 'R':
		num_R += 1
		elements.add('R')
	if char == 'B':
		num_B += 1
		elements.add('B')
	if char == 'G':
		num_G += 1
		elements.add('G')
	if elements == {'B', 'G', 'R'}:
		print('BGR')
		exit()
	if num_R >= 2 and num_B >= 2 or (num_R >= 2 and num_G >= 2) or (num_G >= 2 and num_B >= 2):
		print('BGR')
		exit()
diff = {'B', 'G', 'R'} - elements
if len(elements) == 1:
	print(list(elements)[0])
elif num_R + num_B + num_G == 2:
	print(list(diff)[0])
else:
	if num_R >= 2:
		print('BG')
	if num_G >= 2:
		print('BR')
	if num_B >= 2:
		print('GR')


n = int(input())
a = input()
rt = a.count('R')
gt = a.count('G')
bt = a.count('B')
if gt > 0 and bt > 0 and (rt > 0):
	print('BGR')
elif gt >= 2 and bt >= 2 or (gt >= 2 and rt >= 2) or (rt >= 2 and bt >= 2):
	print('BGR')
elif gt >= 2 and (bt == 1 or rt == 1):
	print('BR')
elif rt >= 2 and (bt == 1 or gt == 1):
	print('BG')
elif bt >= 2 and (gt == 1 or rt == 1):
	print('GR')
elif gt * rt > 0:
	print('B')
elif bt * rt > 0:
	print('G')
elif gt * bt > 0:
	print('R')
elif bt > 0:
	print('B')
elif gt > 0:
	print('G')
elif rt > 0:
	print('R')


n = int(input())
s = input()
b = 0
g = 0
r = 0
b2 = 0
r2 = 0
g2 = 0
b3 = 0
r3 = 0
g3 = 0
for i in range(n):
	if s[i] == 'R':
		r += 1
	elif s[i] == 'G':
		g += 1
	else:
		b += 1
if b > 1:
	b3 = 4
if g > 1:
	g3 = 4
if r > 1:
	r3 = 4
if r == 1:
	r3 = 1
if b == 1:
	b3 = 1
if g == 1:
	g3 = 1
if r3 + g3 + b3 >= 3 and r3 + g3 + b3 != 5 and (r3 + g3 + b3 != 4):
	r2 = 1
	b2 = 1
	g2 = 1
elif r3 + g3 + b3 == 5:
	if r3 == 0:
		r2 = 1
		b2 = 0
		g2 = 0
	if b3 == 0:
		r2 = 0
		b2 = 1
		g2 = 0
	if g3 == 0:
		r2 = 0
		b2 = 0
		g2 = 1
	if r3 == 1:
		r2 = 1
	if b3 == 1:
		b2 = 1
	if g3 == 1:
		g2 = 1
elif r3 + g3 + b3 == 2:
	if r3 == 0:
		r2 = 1
		b2 = 0
		g2 = 0
	if b3 == 0:
		r2 = 0
		b2 = 1
		g2 = 0
	if g3 == 0:
		r2 = 0
		b2 = 0
		g2 = 1
else:
	if r3 > 0:
		r2 = 1
		b2 = 0
		g2 = 0
	if b3 > 0:
		r2 = 0
		b2 = 1
		g2 = 0
	if g3 > 0:
		r2 = 0
		b2 = 0
		g2 = 1
if b2 == 1:
	print('B', end='')
if g2 == 1:
	print('G', end='')
if r2 == 1:
	print('R', end='')


l = lambda : map(int, input().split())
p = lambda : int(input())
ss = lambda : input()
t = int(input())
s = ss()
(r, g, b) = (0, 0, 0)
for i in s:
	if i == 'R':
		r += 1
	elif i == 'B':
		b += 1
	else:
		g += 1
if r and (not g) and (not b) or (not r and b == 1 and (g == 1)):
	print('R')
elif b and (not r) and (not g) or (not b and r == 1 and (g == 1)):
	print('B')
elif g and (not b) and (not r) or (not g and b == 1 and (r == 1)):
	print('G')
elif r >= 2 and (g == 1 and (not b) or (b == 1 and (not g))):
	print('BG')
elif b >= 2 and (g == 1 and (not r) or (r == 1 and (not g))):
	print('GR')
elif g >= 2 and (r == 1 and (not b) or (b == 1 and (not r))):
	print('BR')
elif g and b and r or (g >= 2 and b >= 2) or (b >= 2 and r >= 2) or (r >= 2 and g >= 2):
	print('RGB'[::-1])


n = int(input())
ch = input()
dict = {'G': 0, 'R': 0, 'B': 0}
for x in ch:
	dict[x] += 1
	if dict['G'] != 0 and dict['R'] != 0 and (dict['B'] != 0):
		sol = 'BGR'
		break
if dict['G'] == 0 and dict['R'] == 0:
	sol = 'B'
if dict['B'] == 0 and dict['R'] == 0:
	sol = 'G'
if dict['G'] == 0 and dict['B'] == 0:
	sol = 'R'
if dict['G'] == 1 and dict['B'] == 1 and (dict['R'] == 0):
	sol = 'R'
if dict['G'] == 1 and dict['R'] == 1 and (dict['B'] == 0):
	sol = 'B'
if dict['B'] == 1 and dict['R'] == 1 and (dict['G'] == 0):
	sol = 'G'
if dict['G'] == 1 and dict['B'] > 1 and (dict['R'] == 0):
	sol = 'GR'
if dict['R'] == 1 and dict['B'] > 1 and (dict['G'] == 0):
	sol = 'GR'
if dict['G'] == 1 and dict['R'] > 1 and (dict['B'] == 0):
	sol = 'BG'
if dict['B'] == 1 and dict['R'] > 1 and (dict['G'] == 0):
	sol = 'BG'
if dict['B'] == 1 and dict['G'] > 1 and (dict['R'] == 0):
	sol = 'BR'
if dict['R'] == 1 and dict['G'] > 1 and (dict['B'] == 0):
	sol = 'BR'
if dict['R'] > 1 and dict['G'] > 1 and (dict['B'] == 0):
	sol = 'BGR'
if dict['B'] > 1 and dict['G'] == 0 and (dict['R'] > 1):
	sol = 'BGR'
if dict['R'] == 0 and dict['G'] > 1 and (dict['B'] > 1):
	sol = 'BGR'
print(sol)


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(str(x) + '\n')
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
n = I()
s = S()
d = {}
for i in 'RGB':
	if i in s:
		d[i] = s.count(i)
if len(d) == 1:
	print(list(d.keys())[0])
elif len(d) == 3 or len(d) == 1 or 1 not in d.values():
	print('BGR')
elif len(set(d.values())) == 1:
	print('RGB'.replace(list(d.keys())[0], '').replace(list(d.keys())[1], ''))
elif d[list(d.keys())[0]] == 1:
	print(''.join(sorted(list(d.keys())[0] + 'RGB'.replace(list(d.keys())[0], '').replace(list(d.keys())[1], ''))))
else:
	print(''.join(sorted(list(d.keys())[1] + 'RGB'.replace(list(d.keys())[0], '').replace(list(d.keys())[1], ''))))


n = int(input())
l = [x for x in input()]
s = set(l)
sl = len(s)
alpa = ['B', 'G', 'R']
if sl == 1:
	print(l[0])
elif sl == 3:
	print('BGR')
else:
	l2 = []
	for x in s:
		l2.append(x)
	c1 = l.count(l2[0])
	c2 = l.count(l2[1])
	if c1 > 1 and c2 > 1:
		print('BGR')
	elif c1 > 1:
		x = l2[0]
		for i in alpa:
			if i != x:
				print(i, end='')
		print()
	elif c2 > 1:
		x = l2[1]
		for i in alpa:
			if i != x:
				print(i, end='')
		print()
	else:
		x = l2[1]
		y = l2[0]
		for i in alpa:
			if i != x and i != y:
				print(i, end='')
		print()


n = int(input())
lst = []
s = input()
cb = 0
cg = 0
cr = 0
for i in s:
	if i == 'B' and cb < 2:
		lst.append(1)
		cb += 1
	if i == 'G' and cg < 2:
		lst.append(2)
		cg += 1
	if i == 'R' and cr < 2:
		lst.append(3)
		cr += 1
lst.sort()
if 1 in lst and 2 in lst and (3 in lst) or lst.count(1) + lst.count(2) + lst.count(3) >= 4:
	print('BGR')
elif len(lst) == 3:
	ans = []
	if lst[0] == 1 and lst[1] == lst[2] == 2:
		print('BR')
	if lst[0] == 1 and lst[1] == lst[2] == 3:
		print('BG')
	if lst[2] == 2 and lst[0] == lst[1] == 1:
		print('GR')
	if lst[2] == 3 and lst[0] == lst[1] == 1:
		print('GR')
	if lst[0] == 2 and lst[1] == lst[2] == 3:
		print('BG')
	if lst[2] == 3 and lst[0] == lst[1] == 2:
		print('BR')
elif len(lst) == 2 and lst[0] != lst[1]:
	if 'G' not in s:
		print('G')
	if 'B' not in s:
		print('B')
	if 'R' not in s:
		print('R')
else:
	if 'G' in s:
		print('G')
	if 'B' in s:
		print('B')
	if 'R' in s:
		print('R')


from math import *
from sys import *
from collections import defaultdict
import os, sys
from io import IOBase, BytesIO
M = 10 ** 9 + 7

def pow(a, b):
	res = 1
	while b > 0:
		if b & 1:
			res *= a
		a *= a
		b >>= 1
	return res

def powmod(a, b, m):
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a *= a
		b >>= 1
	return res

def inv(a, m):
	return powmod(a, m - 2, m)

def factor(n):
	potentional_p = 3
	itog_list = {}
	if n % 2 == 0:
		itog_list[2] = 0
	while n % 2 == 0:
		n = n // 2
		itog_list[2] += 1
	while n - 1:
		if potentional_p > n ** 0.5:
			if n in itog_list:
				itog_list[n] += 1
			else:
				itog_list[n] = 1
			return itog_list
		while n % potentional_p == 0:
			n = n // potentional_p
			if potentional_p in itog_list:
				itog_list[potentional_p] += 1
			else:
				itog_list[potentional_p] = 1
		potentional_p += 2
	return itog_list

def main():
	t = int(input())
	s = input()
	r = s.count('R')
	g = s.count('G')
	b = s.count('B')
	if r > 0 and g > 0 and (b > 0):
		print('BGR')
	elif r == 0 and b > 0 and (g > 0):
		if b == 1 and g == 1:
			print('R')
		elif b == 1 and g >= 2:
			print('BR')
		elif b >= 2 and g == 1:
			print('GR')
		else:
			print('BGR')
	elif b == 0 and r > 0 and (g > 0):
		if r == 1 and g == 1:
			print('B')
		elif r == 1 and g >= 2:
			print('BR')
		elif r >= 2 and g == 1:
			print('BG')
		else:
			print('BGR')
	elif g == 0 and r > 0 and (b > 0):
		if r == 1 and b == 1:
			print('G')
		elif r == 1 and b >= 2:
			print('GR')
		elif r >= 2 and b == 1:
			print('BG')
		else:
			print('BGR')
	elif b > 0:
		print('B')
	elif r > 0:
		print('R')
	elif g > 0:
		print('G')
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


int(input())
b = input()
R = b.count('R')
B = b.count('B')
G = b.count('G')
if R == len(b):
	print('R')
elif B == len(b):
	print('B')
elif G == len(b):
	print('G')
elif R and B and G:
	print('BGR')
elif len(b) == 2:
	print(*[i for i in 'RBG' if i not in b])
elif min(B, G) == 1 or min(B, R) == 1 or min(R, G) == 1:
	ans = ''
	if G == 1:
		ans += 'G'
	elif B == 1:
		ans += 'B'
	else:
		ans += 'R'
	ans += ''.join([i for i in 'RBG' if b.count(i) == 0])
	print(*sorted(ans), sep='')
else:
	print('BGR')


cache = {}

def foo(a):
	n = len(a)
	if n == 1:
		return {a}
	if a in cache:
		return cache[a]
	s = set()
	for i in range(n):
		for j in range(i + 1, n):
			if a[i] == a[j]:
				x = a[:i] + a[i + 1:j] + a[j + 1:]
				s = s.union(foo(x + a[i]))
			else:
				x = a[:i] + a[i + 1:j] + a[j + 1:]
				s = s.union(foo(x + diff(a[i], a[j])))
	cache[a] = s
	return s

def diff(x, y):
	s = {x, y}
	return list({'R', 'G', 'B'} - s)[0]
n = int(input())
s = input().strip()
t = []
for i in s:
	if t.count(i) <= 2:
		t.append(i)
t = ''.join(t)
s = foo(t)
s = sorted(list(s))
print(''.join(s))


R = lambda : map(int, input().split())
n = int(input())
s = input()
(b, g, r) = (s.count('B'), s.count('G'), s.count('R'))
mp = [(b, 'B'), (g, 'G'), (r, 'R')]
zeros = (b == 0) + (g == 0) + (r == 0)
if zeros == 0:
	print('BGR')
elif zeros == 1:
	if max(b, g, r) >= 2 and b + g + r - max(b, g, r) >= 2:
		print('BGR')
	elif b + g + r == 2:
		print(min(mp)[1])
	else:
		tmp = sorted(mp)[:2]
		print(''.join(sorted([tmp[0][1], tmp[1][1]])))
else:
	print(max(mp)[1])


import time

def pr(d, k):
	ans = []
	for i in d.keys():
		if d[i] == k:
			ans = i
	return ans
n = int(input())
a = list(input())
start = time.time()
d = {'R': 0, 'G': 0, 'B': 0}
for i in a:
	d[i] += 1
b = list(set(a))
if len(b) == 1:
	ans = b[0]
elif len(b) == 2:
	if d[b[0]] == 1 and d[b[1]] == 1:
		ans = pr(d, 0)
	elif d[b[0]] == 1:
		ans = b[0] + pr(d, 0)
	elif d[b[1]] == 1:
		ans = b[1] + pr(d, 0)
	else:
		ans = 'BGR'
else:
	ans = 'BGR'
for i in sorted(ans):
	print(i, end='')
print()
finish = time.time()


n = int(input())
s = input()
b = s.count(s[0])
if b == n:
	print(s[0])
	quit()
k = 0
o = ''
b = s.count('B')
if b:
	k += 1
else:
	o += 'B'
g = s.count('G')
if g:
	k += 1
else:
	o += 'G'
r = s.count('R')
if r:
	k += 1
else:
	o += 'R'
if n == 2:
	print(o)
	quit()
if k == 3:
	print('BGR')
	quit()
if b and g:
	if b > g and g < 2:
		o += 'G'
	elif g > b and b < 2:
		o += 'B'
	else:
		o += 'GB'
elif b and r:
	if b > r and r < 2:
		o += 'R'
	elif r > b and b < 2:
		o += 'B'
	else:
		o += 'BR'
elif g > r and r < 2:
	o += 'R'
elif r > g and g < 2:
	o += 'G'
else:
	o += 'RG'
del k
k = list(o)
k.sort()
for i in k:
	print(i, end='')
print()


n = input()
s = input()
q = (cR, cG, cB) = (s.count('R'), s.count('G'), s.count('B'))
if q[0] and q[1] and q[2] or (q[0] > 1 and q[1] > 1) or (q[0] > 1 and q[2] > 1) or (q[1] > 1 and q[2] > 1):
	print('BGR')
elif q[0] == 0 and q[1] == 0 or (q[0] == 1 and q[1] == 1):
	print('B')
elif q[1] == 0 and q[2] == 0 or (q[1] == 1 and q[2] == 1):
	print('R')
elif q[0] == 0 and q[2] == 0 or (q[0] == 1 and q[2] == 1):
	print('G')
elif q[0] == 1 and q[1] > 1 or (q[2] == 1 and q[1] > 1):
	print('BR')
elif q[0] == 1 and q[2] > 1 or (q[1] == 1 and q[2] > 1):
	print('GR')
elif q[1] == 1 and q[0] > 1 or (q[2] == 1 and q[0] > 1):
	print('BG')


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from itertools import combinations, permutations
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
n = ii()
s = ip()
arr = Counter(s)
x = list(set(s))
if len(x) == 1:
	print(x[0])
elif len(x) == 3:
	print('BGR')
else:
	ans = list('BGR')
	if arr[x[0]] > 1 and arr[x[1]] > 1:
		print('BGR')
	elif n == 2:
		ans.remove(x[1])
		ans.remove(x[0])
		print(''.join(ans))
	else:
		ans = list('BGR')
		for (i, j) in arr.items():
			if j > 1:
				ans.remove(i)
		print(''.join(sorted(ans)))


from itertools import accumulate
n = int(input())
s = input()
D = {'R': 0, 'G': 0, 'B': 0}
for c in s:
	D[c] += 1
L = ['R', 'G', 'B']
L.sort(key=lambda c: -D[c])
if all((D[c] > 0 for c in L)) or (D[L[0]] > 1 and D[L[1]] > 1):
	print('BGR')
elif D[L[1]] == 1 and D[L[0]] > 1:
	L.pop(0)
	L.sort()
	print(''.join(L))
elif D[L[1]] == 1 and D[L[0]] == 1:
	print(L[2])
else:
	print(L[0])


n = int(input())
s = input()
count = {'R': 0, 'G': 0, 'B': 0}
sets = set(s)
for i in range(n):
	count[s[i]] += 1
ans = set('')

def find(a, ans):
	left = list(set('RGB') - set(a))
	if count[left[0]] == 1 and count[left[1]] == 0 or (count[left[1]] == 1 and count[left[0]] == 0):
		x = 1
	else:
		ans.add(a)
	return ans
if len(sets) == 1:
	print(''.join(list(sets)))
else:
	ans = find('R', ans)
	ans = find('B', ans)
	ans = find('G', ans)
	ans = list(ans)
	ans.sort()
	print(''.join(ans))


from collections import Counter
n = int(input().strip())
s = input().strip()
counter = Counter(s)
s_colors = set(counter.keys())
ans = ''
if len(s_colors) == 3 or (counter['B'] >= 2 and counter['G'] >= 2) or (counter['G'] >= 2 and counter['R'] >= 2) or (counter['B'] >= 2 and counter['R'] >= 2):
	ans = 'BGR'
elif len(s_colors) == 1:
	ans = s_colors.pop()
elif counter['B'] == 1 and counter['G'] == 1 or (counter['G'] == 1 and counter['R'] == 1) or (counter['B'] == 1 and counter['R'] == 1):
	ans = set('BGR').difference(s_colors).pop()
else:
	for c in s_colors:
		other_color = s_colors.difference({c}).pop()
		if counter[c] >= 2 and counter[other_color] == 1:
			ans = ''.join(sorted(set('BGR').difference({c})))
			break
print(ans)


from collections import Counter
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys
import sys
import math
n = int(input())
s = input()
c = Counter(s)
ls = []
for i in c:
	ls.append(i)
ana = 'RGB'
if 'R' in s and 'G' in s and ('B' in s):
	print('BGR')
elif s == 'R' * n or s == 'B' * n or s == 'G' * n:
	print(s[0])
elif c[ls[0]] >= 2 and c[ls[1]] >= 2:
	print('BGR')
elif c[ls[0]] >= 2 or c[ls[1]] >= 2:
	if c[ls[0]] >= 2:
		if ls[0] == 'B':
			print('GR')
		elif ls[0] == 'R':
			print('BG')
		else:
			print('BR')
	elif ls[1] == 'B':
		print('GR')
	elif ls[1] == 'R':
		print('BG')
	else:
		print('BR')
elif 'R' not in s:
	print('R')
elif 'G' not in s:
	print('G')
else:
	print('B')


a = int(input())
per = input()
r = 0
g = 0
b = 0
for i in per:
	if i == 'R':
		r += 1
	if i == 'G':
		g += 1
	if i == 'B':
		b += 1
if r != 0 and b != 0 and (g != 0):
	print('BGR')
elif r == 0 and b == 0:
	print('G')
elif r == 0 and g == 0:
	print('B')
elif g == 0 and b == 0:
	print('R')
elif r == 0:
	if g > 1:
		print('B', end='')
	if b > 1:
		print('G', end='')
	print('R', end='')
elif g == 0:
	if r > 1:
		print('B', end='')
	print('G', end='')
	if b > 1:
		print('R', end='')
elif b == 0:
	print('B', end='')
	if r > 1:
		print('G', end='')
	if g > 1:
		print('R', end='')


import sys
from sys import stdout, stdin
input = lambda : sys.stdin.readline()
n = int(input())
s = input()
s = (s.count('B'), s.count('G'), s.count('R'))
if s[0] > 0 and s[1] > 0 and (s[2] > 0):
	stdout.write('BGR')
elif s[0] == 0 and s[1] == 0:
	stdout.write('R')
elif s[1] == 0 and s[2] == 0:
	stdout.write('B')
elif s[0] == 0 and s[2] == 0:
	stdout.write('G')
elif s == (0, 1, 1):
	stdout.write('B')
elif s == (1, 0, 1):
	stdout.write('G')
elif s == (1, 1, 0):
	stdout.write('R')
elif s[0] == 0 and s[1] == 1:
	stdout.write('BG')
elif s[0] == 0 and s[2] == 1:
	stdout.write('BR')
elif s[1] == 0 and s[0] == 1:
	stdout.write('BG')
elif s[1] == 0 and s[2] == 1:
	stdout.write('GR')
elif s[2] == 0 and s[0] == 1:
	stdout.write('BR')
elif s[2] == 0 and s[1] == 1:
	stdout.write('GR')
else:
	stdout.write('BGR')


import sys
n = int(sys.stdin.readline())
s = sys.stdin.readline().strip()
red = 0
blue = 0
green = 0
for c in s:
	if c == 'R':
		red += 1
	elif c == 'G':
		green += 1
	elif c == 'B':
		blue += 1
if red >= 1 and blue >= 1 and (green >= 1):
	print('BGR')
elif red == 0 and green == 0:
	print('B')
elif red == 0 and blue == 0:
	print('G')
elif green == 0 and blue == 0:
	print('R')
elif red == 1 and green == 1:
	print('B')
elif red == 1 and blue == 1:
	print('G')
elif green == 1 and blue == 1:
	print('R')
elif red > 1 and (green == 1 or blue == 1):
	print('BG')
elif blue > 1 and (green == 1 or red == 1):
	print('GR')
elif green > 1 and (blue == 1 or red == 1):
	print('BR')
else:
	print('BGR')


from collections import Counter
n = int(input())
string = input()
cnt = Counter()
for (idx, c) in enumerate(string):
	cnt[c] += 1
cols = list()
if cnt['R'] != 0:
	cols.append('R')
if cnt['G'] != 0:
	cols.append('G')
if cnt['B'] != 0:
	cols.append('B')
if len(cols) == 3 or (len(cols) == 2 and cnt[cols[0]] > 1 and (cnt[cols[1]] > 1)):
	print(''.join(sorted('RGB')))
elif len(cols) == 2:
	if cnt[cols[0]] == 1 and cnt[cols[1]] == 1:
		if 'R' not in cols:
			print('R')
		elif 'G' not in cols:
			print('G')
		else:
			print('B')
	else:
		ans = list()
		if cnt[cols[0]] == 1:
			ans.append(cols[0])
		else:
			ans.append(cols[1])
		if 'R' not in cols:
			ans.append('R')
		elif 'G' not in cols:
			ans.append('G')
		else:
			ans.append('B')
		print(''.join(sorted(ans)))
else:
	print(cols[0])


n = int(input())
s = input()
d = {}
d['G'] = 0
d['R'] = 0
d['B'] = 0
for i in s:
	d[i] += 1
if d['R'] >= 1 and d['G'] >= 1 and (d['B'] >= 1):
	print('BGR')
elif d['R'] > 1 and d['G'] > 1 or (d['G'] > 1 and d['B'] > 1) or (d['R'] > 1 and d['B'] > 1):
	print('BGR')
elif d['R'] > 1 and (d['G'] == 1 or d['B'] == 1):
	print('BG')
elif d['B'] > 1 and (d['G'] == 1 or d['R'] == 1):
	print('GR')
elif d['G'] > 1 and (d['R'] == 1 or d['B'] == 1):
	print('BR')
elif d['G'] == 1 and d['B'] == 1:
	print('R')
elif d['B'] == 1 and d['R'] == 1:
	print('G')
elif d['G'] == 1 and d['R'] == 1:
	print('B')
elif d['G'] >= 1:
	print('G')
elif d['B'] >= 1:
	print('B')
elif d['R'] >= 1:
	print('R')


import collections, itertools, functools, math, sys

@functools.lru_cache(None)
def dp(r, g, b):
	if r + g + b == 1:
		if r:
			return 1
		if g:
			return 2
		if b:
			return 4
	res = 0
	if r >= 2:
		res |= dp(r - 1, g, b)
	if g >= 2:
		res |= dp(r, g - 1, b)
	if b >= 2:
		res |= dp(r, g, b - 1)
	if r > 0 and g > 0:
		res |= dp(r - 1, g - 1, b + 1)
	if r > 0 and b > 0:
		res |= dp(r - 1, g + 1, b - 1)
	if g > 0 and b > 0:
		res |= dp(r + 1, g - 1, b - 1)
	return res

def solve():
	n = int(input())
	cnt = collections.Counter(input())
	r = dp(cnt['R'], cnt['G'], cnt['B'])
	return [None, 'R', 'G', 'GR', 'B', 'BR', 'BG', 'BGR'][r]
sys.setrecursionlimit(10000)
print(solve())


from collections import Counter
n = int(input())
if n == 1:
	print(input())
if n > 1:
	c = Counter({'R': 0, 'G': 0, 'B': 0})
	c.update(input())
	(r, g, b) = sorted('RGB', key=c.get)
	print(''.join(sorted('RGB' if c[r] else (r if n == 2 else r + g) if c[g] == 1 else 'RGB' if c[g] else b)))


(n, s) = (int(input()), input())
(r, g) = (s.count('R'), s.count('G'))
b = n - r - g
print('%s%s%s' % ('B' if g and r or (b and g + r > 1) or g + r < 1 else '', 'G' if r and b or (g and b + r > 1) or b + r < 1 else '', 'R' if g and b or (r and g + b > 1) or g + b < 1 else ''))


n = int(input())
RGB = str(input())
rgb = ''
(R, G, B) = (0, 0, 0)
if 'B' in RGB and 'G' in RGB and ('R' in RGB):
	rgb += 'BGR'
for Char in RGB:
	if Char == 'R':
		R += 1
	if Char == 'G':
		G += 1
	if Char == 'B':
		B += 1
if not B and (not G) or (not R and (not B)) or (not G and (not R)):
	rgb += RGB[0]
if not rgb:
	if not B:
		if R == G:
			if n <= 3:
				rgb += 'B'
			else:
				rgb += 'BGR'
		elif abs(G - R) == 1:
			if n > 3:
				rgb += 'BGR'
			elif G > R:
				rgb += 'BR'
			else:
				rgb += 'BG'
		elif R == 1:
			if G % 2 == 0:
				rgb += 'BR'
			else:
				rgb += 'B'
		elif G == 1:
			if R % 2 == 0:
				rgb += 'BG'
			else:
				rgb += 'BG'
		else:
			rgb += 'BGR'
	if not G:
		if R == B:
			if n <= 3:
				rgb += 'G'
			else:
				rgb += 'BGR'
		elif abs(B - R) == 1:
			if n > 3:
				rgb += 'BGR'
			elif B > R:
				rgb += 'GR'
			else:
				rgb += 'BG'
		elif R == 1:
			if G % 2 == 0:
				rgb += 'GR'
			else:
				rgb += 'G'
		elif B == 1:
			if R % 2 == 0:
				rgb += 'BG'
			else:
				rgb += 'BG'
		else:
			rgb += 'BGR'
	if not R:
		if B == G:
			if n > 3:
				rgb += 'BGR'
			else:
				rgb += 'R'
		elif abs(G - B) == 1:
			if n > 3:
				rgb += 'BGR'
			elif G > B:
				rgb += 'BR'
			else:
				rgb += 'GR'
		elif B == 1:
			if G % 2 == 0:
				rgb += 'BR'
			else:
				rgb += 'R'
		elif G == 1:
			if B % 2 == 0:
				rgb += 'GR'
			else:
				rgb += 'GR'
		else:
			rgb += 'BGR'
print(rgb)


def main():
	n = int(input())
	s = input()
	r = s.count('R')
	g = s.count('G')
	b = s.count('B')
	if r > 0 and g > 0 and (b > 0):
		print('BGR')
		return
	r = min(r, 2)
	g = min(g, 2)
	b = min(b, 2)
	a = (r, 'R')
	c = (b, 'B')
	b = (g, 'G')
	if a[0] < b[0]:
		(a, b) = (b, a)
	if b[0] < c[0]:
		(b, c) = (c, b)
	if a[0] < b[0]:
		(a, b) = (b, a)
	if a[0] == 2 and b[0] == 2:
		print('BGR')
		return
	if a[0] == 2 and b[0] == 1:
		print(''.join(sorted((c[1], b[1]))))
	if a[0] > 0 and b[0] == 0:
		print(a[1])
	if a[0] == 1 and b[0] == 1:
		print(c[1])
main()


n = int(input())
input_string = input()
map = {}
for i in range(0, len(input_string)):
	if input_string[i] in map:
		map[input_string[i]] += 1
	else:
		map[input_string[i]] = 1
if len(map) == 3:
	print('BGR')
if len(map) == 2:
	sum = 0
	check = False
	check_key = ''
	other_key = ''
	for key in map.keys():
		sum += map[key]
		if map[key] == 1:
			check = True
			check_key = key
		else:
			other_key = key
	if sum == 2:
		if 'G' not in map:
			print('G')
		if 'R' not in map:
			print('R')
		if 'B' not in map:
			print('B')
	elif check == True:
		if other_key == 'R' and check_key == 'G':
			print('BG')
		if other_key == 'B' and check_key == 'G':
			print('GR')
		if other_key == 'B' and check_key == 'R':
			print('GR')
		if other_key == 'G' and check_key == 'R':
			print('BR')
		if other_key == 'R' and check_key == 'B':
			print('BG')
		if other_key == 'G' and check_key == 'B':
			print('BR')
	else:
		print('BGR')
if len(map) == 1:
	for key in map.keys():
		print(key)


n = int(input())
data = list(input())
w = 'BGR'
cnt = [data.count(i) for i in w]
res = ''
for i in range(3):
	(x, y, z) = (cnt[i], cnt[(i + 1) % 3], cnt[(i + 2) % 3])
	if x >= 1 and y == z == 0 or (y >= 1 and z >= 1) or (x >= 1 and (y >= 2 or z >= 2)):
		res += w[i]
print(res)


n = int(input())
ch = str(input())
r = ''
R = ch.count('R')
B = ch.count('B')
G = ch.count('G')
if R and B and G:
	print('BGR')
elif R >= 2 and B >= 2 or (G >= 2 and R >= 2) or (G >= 2 and B >= 2):
	print('BGR')
elif R >= 2 and (B == 1 or G == 1):
	print('BG')
elif B >= 2 and (R == 1 or G == 1):
	print('GR')
elif G >= 2 and (B == 1 or R == 1):
	print('BR')
elif B and G:
	print('R')
elif R and G:
	print('B')
elif B and R:
	print('G')
elif B:
	print('B')
elif G:
	print('G')
else:
	print('R')


n = int(input())
s = input()
st = {'R', 'G', 'B'}
if s.count(s[0]) == n:
	print(s[0])
elif st == set(s):
	print(''.join(sorted(list(st))))
elif len(set(s)) == 2:
	if s.count(list(set(s))[0]) > 1 and s.count(list(set(s))[1]) > 1:
		print(''.join(sorted(list(st))))
	elif s.count(list(set(s))[0]) > 1:
		print(''.join(sorted(list(st - set(s))[0] + list(set(s))[1])))
	elif s.count(list(set(s))[1]) > 1:
		print(''.join(sorted(list(st - set(s))[0] + list(set(s))[0])))
	else:
		print(list(st - set(s))[0])


le = int(input())
s = input()
l = [0, 0, 0]
for i in range(le):
	c = s[i]
	if c == 'B':
		l[0] += 1
	elif c == 'G':
		l[1] += 1
	else:
		l[2] += 1
if min(l) > 0:
	print('BGR')
elif l[0] == 0 and l[1] == 0:
	print('R')
elif l[2] == 0 and l[1] == 0:
	print('B')
elif l[0] == 0 and l[2] == 0:
	print('G')
elif l[0] == 0:
	if l[1] == 1 and l[2] == 1:
		print('B')
	elif l[1] == 1:
		print('BG')
	elif l[2] == 1:
		print('BR')
	else:
		print('BGR')
elif l[1] == 0:
	if l[0] == 1 and l[2] == 1:
		print('G')
	elif l[0] == 1:
		print('BG')
	elif l[2] == 1:
		print('GR')
	else:
		print('BGR')
elif l[1] == 1 and l[0] == 1:
	print('R')
elif l[0] == 1:
	print('BR')
elif l[1] == 1:
	print('GR')
else:
	print('BGR')


NumberOfCards = int(input())
InputString = input()
NumbersOfColors = {'B': 0, 'G': 0, 'R': 0}
for Letter in InputString:
	NumbersOfColors[Letter] += 1
NumberOfColors = 0
for value in list(NumbersOfColors.values()):
	if value > 0:
		NumberOfColors += 1
if NumberOfColors == 1:
	for (key, value) in NumbersOfColors.items():
		if value > 0:
			print(key)
			quit()
if NumberOfColors == 2:
	if NumberOfCards == 2:
		for (key, value) in NumbersOfColors.items():
			if value == 0:
				print(key)
				quit()
	if 1 in NumbersOfColors.values():
		s = ''
		for (key, value) in NumbersOfColors.items():
			if value <= 1:
				s += str(key)
		print(''.join(sorted(s)))
		quit()
print('BGR')


input()
rgb = input().strip()
r = rgb.count('R')
g = rgb.count('G')
b = rgb.count('B')
if r == len(rgb) or g == len(rgb) or b == len(rgb):
	if r == len(rgb):
		print('R')
	if g == len(rgb):
		print('G')
	if b == len(rgb):
		print('B')
elif r != 0 and g != 0 and (b != 0):
	print('BGR')
elif r == 0:
	if g == 1 and b == 1:
		print('R')
	elif g > 1 and b > 1:
		print('BGR')
	elif g > 1 and b == 1:
		print('BR')
	elif g == 1 and b > 1:
		print('GR')
elif g == 0:
	if b == 1 and r == 1:
		print('G')
	elif b > 1 and r > 1:
		print('BGR')
	elif b > 1 and r == 1:
		print('GR')
	elif b == 1 and r > 1:
		print('BG')
elif b == 0:
	if g == 1 and r == 1:
		print('B')
	elif g > 1 and r > 1:
		print('BGR')
	elif g > 1 and r == 1:
		print('BR')
	elif g == 1 and r > 1:
		print('BG')


def solution(s):
	(cR, cG, cB) = (0, 0, 0)
	for ch in s:
		if ch == 'R':
			cR += 1
		elif ch == 'G':
			cG += 1
		else:
			cB += 1
	if cR > 0 and cG > 0 and (cB > 0) or sorted([cR, cG, cB])[1] > 1:
		return 'BGR'
	if cR == 0 and cG == 0:
		return 'B'
	if cG == 0 and cB == 0:
		return 'R'
	if cR == 0 and cB == 0:
		return 'G'
	if s == 'GR' or s == 'RG':
		return 'B'
	if s == 'RB' or s == 'BR':
		return 'G'
	if s == 'BG' or s == 'GB':
		return 'R'
	if cR > 1:
		return 'BG'
	if cG > 1:
		return 'BR'
	return 'GR'
N = int(input())
s = input()
print(solution(s))


from collections import Counter

def go(s):
	ct = Counter(s)
	pos = ''.join((c for c in 'BGR' if ct[c] > 0))
	if len(pos) == 3 or len(pos) == 1:
		return pos
	one = ''.join((c for c in 'BGR' if ct[c] <= 1))
	if len(one) == 1:
		return 'BGR'
	if len(one) == 2:
		return one
	return ''.join((c for c in 'BGR' if ct[c] == 0))
input()
print(go(input()))


a = int(input())
s = input()
arr = [0, 0, 0]
for i in range(len(s)):
	if s[i] == 'B':
		arr[0] += 1
	elif s[i] == 'G':
		arr[1] += 1
	else:
		arr[2] += 1
b = arr[0]
g = arr[1]
r = arr[2]
a = [False, False, False]
if b > 0 and g > 0 and (r > 0):
	a = [True, True, True]
elif b == 0 and g == 0:
	a = [False, False, True]
elif b == 0 and r == 0:
	a = [False, True, False]
elif g == 0 and r == 0:
	a = [True, False, False]
elif b == 0:
	if g > 1 and r > 1:
		a = [True, True, True]
	elif g == 1 and r > 1:
		a = [True, True, False]
	elif r == 1 and g > 1:
		a = [True, False, True]
	else:
		a = [True, False, False]
elif g == 0:
	if b > 1 and r > 1:
		a = [True, True, True]
	elif b == 1 and r > 1:
		a = [True, True, False]
	elif r == 1 and b > 1:
		a = [False, True, True]
	else:
		a = [False, True, False]
elif r == 0:
	if g > 1 and b > 1:
		a = [True, True, True]
	elif g == 1 and b > 1:
		a = [False, True, True]
	elif b == 1 and g > 1:
		a = [True, False, True]
	else:
		a = [False, False, True]
t = ''
if a[0] == True:
	t += 'B'
if a[1] == True:
	t += 'G'
if a[2] == True:
	t += 'R'
print(t)


def visit(r, g, b):
	if r < 0 or g < 0 or b < 0:
		return
	if vis[r][g][b]:
		return
	vis[r][g][b] = True
	if r > 1:
		visit(r - 1, g, b)
	if g > 1:
		visit(r, g - 1, b)
	if b > 1:
		visit(r, g, b - 1)
	visit(r - 1, g - 1, b + 1)
	visit(r + 1, g - 1, b - 1)
	visit(r - 1, g + 1, b - 1)
n = int(input())
s = input()
vis = [[[False for i in range(201)] for j in range(201)] for k in range(200)]
h = {'R': 0, 'G': 0, 'B': 0}
for i in s:
	h[i] += 1
visit(h['R'], h['G'], h['B'])
if vis[0][0][1]:
	print('B', end='')
if vis[0][1][0]:
	print('G', end='')
if vis[1][0][0]:
	print('R', end='')


def solve(a: list) -> str:
	(r, g, b) = (a[0], a[1], a[2])
	if r == 0 and g == 0 or (r == 1 and g == 1 and (b == 0)):
		return 'B'
	elif r == 0 and b == 0 or (r == 1 and g == 0 and (b == 1)):
		return 'G'
	elif b == 0 and g == 0 or (r == 0 and g == 1 and (b == 1)):
		return 'R'
	elif r == 0 and g == 1:
		return 'GR'
	elif r == 0 and b == 1:
		return 'BR'
	elif g == 0 and b == 1:
		return 'BG'
	elif g == 0 and r == 1:
		return 'GR'
	elif b == 0 and g == 1:
		return 'BG'
	elif b == 0 and r == 1:
		return 'BR'
	else:
		return 'BGR'

def main():
	n = int(input())
	s = input()
	a = [s.count('R'), s.count('G'), s.count('B')]
	print(solve(a))
main()


import sys
n = map(int, input().split())
s = input()
d = {}
for a in s:
	try:
		d[a] += 1
	except KeyError:
		d[a] = 1
if len(d) == 3:
	print('BGR')
	sys.exit(0)
if len(d) == 1:
	print(s[0])
	sys.exit(0)
k = list(d.keys())
a = k[0]
b = k[1]
l = ['G', 'R', 'B']
if d[a] == 1 and d[b] == 1:
	for j in l:
		if j not in k:
			print(j)
			sys.exit(0)
if d[a] > 1 and d[b] > 1:
	print('BGR')
	sys.exit(0)
if d[a] == 1:
	for j in l:
		if j not in k:
			if a < j:
				print(a + j)
			else:
				print(j + a)
			sys.exit(0)
if d[b] == 1:
	for j in l:
		if j not in k:
			if b < j:
				print(b + j)
			else:
				print(j + b)
			sys.exit(0)