Harryxun/stf_run huggingface dataset:
x = input(int())
print("ABC" if x < 1200 else "ARC")

### FIXED CODE ###

x = int(input())
print("ABC" if x < 1200 else "ARC")
def main():
    N = int(input())
    A = [[int(i) for i in input().split()] for j in range(N)]
    A.sort()
    from collections import defaultdict
    cnt = defaultdict(int)
    for i in range(N):
        for j in range(i+1, N):
            # print(A[i], A[j], (A[j][0] - A[i][0], A[j][1] - A[i][1]))
            cnt[(A[j][0] - A[i][0], A[j][1] - A[i][1])] += 1
    # print(cnt.values())
    ans = (N-1) - (sorted(cnt.values())[-1] - 1)
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N = int(input())
    A = [[int(i) for i in input().split()] for j in range(N)]
    if N == 1:
        return print(1)
    A.sort()
    from collections import defaultdict
    cnt = defaultdict(int)
    for i in range(N):
        for j in range(i+1, N):
            # print(A[i], A[j], (A[j][0] - A[i][0], A[j][1] - A[i][1]))
            cnt[(A[j][0] - A[i][0], A[j][1] - A[i][1])] += 1
    # print(cnt.values())
    ans = (N-1) - (sorted(cnt.values())[-1] - 1)
    print(ans)


if __name__ == '__main__':
    main()
s=input()
t=input()
a=0
for i in range(3)
  if s[i]==t[i]:
    a+=1
print(a)

### FIXED CODE ###

s=input()
t=input()
a=0
for i in range(3):
  if s[i]==t[i]:
    a+=1
print(a)
a,b,k=map(int,input().split())
nums=list(range(a,b+1))
start=nums[:k]
end=nums[len(nums)-k:]
ans=start+end
for i in ans:
    print(i)

### FIXED CODE ###

a, b, k = map(int,input().split())
if b-a+1 >= 2*k:
    aa = [a+i for i in range(k)]
    bb = [b-i for i in range(k)]
    cc = sorted(aa+bb)
    for s in cc:
        print(s)
else:
    for s in range(a,b+1):
        print(s)
import math
n = int(input())
print(2*n//math.gcd(2,n)) #最小公倍数

### FIXED CODE ###

import math

n = int(input())
asn = 0

if n % 2 == 0: ans = n
else: ans = 2*n

print(ans)
def main():
    n = input()
    before = ''
    words = set()

    for i in range(n):
        w = input()
        if w not in words:
            words.add(w)
        else:
            print('No')
            return

        if before == '':
            before = w
            continue

        if before[-1] != w[0]:
            print('No')
            return

    print('Yes')


main()


### FIXED CODE ###

def main():
    n = int(input())
    before = ''
    words = set()

    for i in range(n):
        w = input()
        if w not in words:
            words.add(w)
        else:
            print('No')
            return

        if before == '':
            before = w
            continue

        if before[-1] != w[0]:
            print('No')
            return
        before = w

    print('Yes')


main()
isExist = [False]*2001 
n = int( input() )
q = int( input() )
for i in range( 0, 3 ):
	print( "yes" )

### FIXED CODE ###

def solve( p, t ):
	global isExist, n, A
	isExist[ t ] = True
	if p < n:
		solve( p+1, t-A[p] )
		solve( p+1, t )
	else:
		return

isExist = [False]*2001 
n = int( input() )
A = [ int( val ) for val in input().rstrip().split( ' ' ) ]
q = int( input() )
M = [ int( val ) for val in input().rstrip().split( ' ' ) ]
s = sum( A )
solve( 0, s )
for i in range( 0, q ):
	if isExist[ M[i] ]:
		print( "yes" )
	else:
		print( "no" )
def resolve():
    N = int(input())
    list = list(map(int, input().split()))
    import numpy as np
    ans = np.prod(list)
    print(ans if ans <= 10**18 else "-1")
resolve()

### FIXED CODE ###

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    if 0 in A:
        print(0)
        exit()
    for i in A:
        ans *= i
        if ans > 10**18:
            print(-1)
            exit()
    print(ans)
resolve()
S = input()
K = int(input())
# print(S, K)
for i in range(len(S)):
    if i >= K:
        break
    if s != '1':
        print(s)
        exit()
print('1')


### FIXED CODE ###

S = input()
K = int(input())
# print(S, K)
for i in range(len(S)):
    s = S[i]
    if i >= K:
        break
    if s != '1':
        print(s)
        exit()
print('1')
N,A,B=list(map(lambda i:int(i),input().split()))

answer =0

if A==0:
    answer = 0
elif b==0:
    answer = N
else:
    tail=0
    if N%(A+B) > B:
        tail = B
    else:
        tail = N%(A+B)
    answer = A * (N//(A+B)) + tail

print(answer)


### FIXED CODE ###

N,A,B=list(map(lambda i:int(i),input().split()))

answer =0

if A==0:
    answer = 0
elif B==0:
    answer = N
else:
    tail=0
    if N%(A+B) > A:
        tail = A
    else:
        tail = N%(A+B)
    answer = A * (N//(A+B)) + tail

print(answer)
# -*- coding: utf-8 -*-
import numpy as np
import types

# Input
l = list(map(int, input().split()))
_ = l[0]
K = l[1] - 1 # <---!!

#S = list(map(str, input().split()))
S = list(input())

# Process
if K == 0:
    left = list("")
else:
    left = S[:K]

if K == len(S)-1:
    right = ("")
else:
    right = S[K+1:]

output = left + list(str(S[K]).lower()) + right
print( ''.join(output) )


### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np
import types

# Input
l = list(map(int, input().split()))
_ = l[0]
K = l[1] - 1 # <---!!

#S = list(map(str, input().split()))
S = list(input())

# Process
if K == 0:
    left = list("")
else:
    left = S[:K]

if K == len(S)-1:
    right = list("")
else:
    right = S[K+1:]

output = left + list(str(S[K]).lower()) + right
print( ''.join(output) )
import.math

r = input()

print pi*r*r, 2*pi*r

### FIXED CODE ###

import math

r = float(input())

s = math.pi * r**2
l = 2.0*math.pi*r

print(s, l)
X,A=map(int,input().split())
if x<A :
    print(0)
else:
    print(10)


### FIXED CODE ###

X,A=map(int,input().split())
if X<A :
    print(0)
else:
    print(10)
w,h,x,y=map(int,input().split())
a = 0
if(h==2*x and w ==2*y)
a +=1
print(w*h/2,a)

### FIXED CODE ###

w,h,x,y=map(int,input().split())
a = 0
if(h==2*y and w ==2*x):
  a +=1
print(w*h/2,a)
n, q = map(int, input().split())

# 各ノードのリンクを記録
link_dict = dict()
keys = []
for i in range(n-1):
  a,b = map(int, input().split())
  if a in keys:
    link_dict[str(a-1)].add(b)
  else:
    keys.append(a)
    link_dict[str(a-1)] = {b}
  
# 各ノードの部分木の全てのノードをリストアップ
link_set = [set() for i in range(n-1)]
for i in sorted(keys, reverse=True):
  link_set[int(i) - 1] = set(link_dict[str(i-1)])
  if int(i) < n - 1:
    for j in link_dict[str(int(i) - 1)]:
      if j < n - 1:
        link_set[i - 1] = link_set[i - 1] | link_set[j - 1]

# カウンターの計算を実施
counters = [0] * n
for i in range(q):
  p, x = map(int, input().split())
  counters[p - 1] += x
  for node in link_set[p - 1]:
    counters[node - 1] += x
str_counters = [str(c) for c in counters]
print(' '.join(str_counters))

### FIXED CODE ###

n, q = map(int, input().split())

# 各ノードのリンクを記録
link_set = [set() for _ in range(n-1)]
for i in range(n-1):
  a, b = map(int, input().split())
  link_set[a - 1].add(b)

# カウンターの計算を実施 (O(QN)の計算を避けることがポイント)

## O(Q)の計算
counters = [0] * n
for i in range(q):
  p, x = map(int, input().split())
  counters[p - 1] += x
  
## O(N)の計算
for i in range(n - 1):
  for node in link_set[i]:
    counters[node - 1] += counters[i]

str_counters = [str(c) for c in counters]
print(' '.join(str_counters))
s,t=map(input().split())
a,b=map(int,input().split())
u=input()
if s==u:
  print(a-1,b)
else:
  print(a,b-1)

### FIXED CODE ###

s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()
if s==u:
  print(a-1,b)
else:
  print(a,b-1)
N=int(input())
S=input()

flag=0

if N%2==0:
    for i in range(int(N/2)):
        if S[i]!=S[i+3]:
            flag+=1

    if flag==0:
        print('Yes')
    else:
        print('No')
else:
    print('No')

### FIXED CODE ###

N=int(input())
S=input()
flag=0

if N%2==0:
    for i in  range(0,int(N/2)):
        if S[i]!=S[i+int(N/2)]:
            flag+=1

    if flag==0:
        print('Yes')
    else :
        print('No')
else :
    print('No')
import sys
readline = sys.stdin.readline

n = int(input())
a = []
for _ in range(n):
	a.append(tuple(map(int,input().split())))
a = tuple(a)

play = [0 for _ in range(n)]
flag = [True for _ in range(n)]
count = 0
ans = 0
while True:
	break_flag = True
	for i in range(n):
		if flag[i]:
			num = a[i][play[i]]-1
			if flag[num] and a[num][play[num]]-1 == i:
				play[num] += 1
				play[i] += 1
				flag[num] = False
				flag[i] = False
				break_flag = False
				count += 1
	if break_flag:
		print(-1)
		sys.exit()
		break
	ans += 1
	if count == n*(n-1)//2:
		break
	for i in range(n):
		if play[i] < n-1:
			flag[i] = True
		else:
			flag[i] = False

if ans == 0:
	print(-1)
else:
	print(ans)


### FIXED CODE ###

s = input()
t = input()

ans = 0

for i in range(3):
	if s[i] == t[i]:
		ans += 1

print(ans)
N=int(input())
ku={}
for i in range(9):
  for j in range(9):
    ku.add((i+1)*(j+1));
if N in ku:
  print("Yes")
else:
  print("No")
    

### FIXED CODE ###

import sys
N=int(input())
for i in range(9):
  for j in range(9):
    if N==(i+1)*(j+1):
      print("Yes")
      sys.exit()
print("No")
# -*- coding: utf-8 -*-
"""
C - Traveling Plan
https://beta.atcoder.jp/contests/abc092/tasks/arc093_a

"""
import sys
from sys import stdin

input = stdin.readline


def solve(spots, N):
    spots.append(0)
    total_cost = 0
    cp = 0
    for s in spots:
        total_cost += abs(s - cp)
        cp = s
    # total_cost += abs(spots[-1])

    ans = []
    spots.insert(0, 0)
    for i in range(1, N):
        if spots[i-1] <= spots[i] <= spots[i+1] or spots[i-1] >= spots[i] >= spots[i+1]:
            ans.append(total_cost)
        else:
            t1 = abs(spots[i-1] - spots[i]) * 2
            ans.append((total_cost - t1))

    if spots[-3] >= spots[-2] >= spots[-1] or spots[-3] <= spots[-2] <= spots[-1]:
        ans.append(total_cost)
    else:
        if spots[-2] <= spots[-3] <= spots[-1]:
            t2 = abs(spots[-3] - spots[-2]) * 2
        elif spots[-2] <= spots[-1] <= spots[-3]:
            t2 = abs(spots[-1] - spots[-2]) * 2
        ans.append(total_cost - t2)


    return ans


def main(args):
    N = int(input())
    spots = [int(x) for x in input().split()]
    ans = solve(spots, N)
    print(*ans, sep='\n')


if __name__ == '__main__':
    main(sys.argv[1:])
    


### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
C - Traveling Plan
https://beta.atcoder.jp/contests/abc092/tasks/arc093_a

"""
import sys
from sys import stdin

input = stdin.readline


def solve(spots, N):
    total_cost = 0
    cp = 0
    for s in spots:
        total_cost += abs(s - cp)
        cp = s
    total_cost += abs(spots[-1])

    ans = []
    spots.append(0)
    spots.insert(0, 0)
    for i in range(1, N):
        if spots[i-1] <= spots[i] <= spots[i+1] or spots[i-1] >= spots[i] >= spots[i+1]:
            ans.append(total_cost)
        else:
            if spots[i] <= spots[i-1] <= spots[i+1]:
                t = abs(spots[i] - spots[i-1]) * 2
            elif spots[i-1] <= spots[i+1] <= spots[i]:
                t = abs(spots[i] - spots[i+1]) * 2
            elif spots[i-1] >= spots[i+1] >= spots[i]:
                t = abs(spots[i] - spots[i+1]) * 2
            else:
                t = abs(spots[i] - spots[i-1]) * 2
            ans.append((total_cost - t))

    spots = spots[:-2]
    total_cost = 0
    cp = 0
    for s in spots:
        total_cost += abs(s - cp)
        cp = s
    total_cost += abs(spots[-1])
    ans.append(total_cost)

    return ans


def main(args):
    N = int(input())
    spots = [int(x) for x in input().split()]
    ans = solve(spots, N)
    print(*ans, sep='\n')


if __name__ == '__main__':
    main(sys.argv[1:])
def ary3(x, y, z, v): return [[[v for _  in range(z)] for _ in range(y)] for _ in range(x)]

n, a = map(int, input().split())
x = list(map(int, input().split()))
m = max(x)
dp = ary3(n + 1, n + 1, m * n + 1, 0)#(選べる枚数（範囲）0 ~ n, 選んだ枚数0 ~ n, 合計0 ~ n * max(x)) = パターン数

for i in range(n + 1):
    dp[i][0][0] = 1

for i in range(1, n + 1):
    for j in range(1, i + 1):
        for s in range(m * n + 1):
            if s + x[i - 1] < m * n + 1:
                dp[i][j][s + x[i-1]] += dp[i - 1][j - 1][s]
            dp[i][j][s] += dp[i - 1][j][s]

ans = 0
for j in range(1, n + 1):
    ans += dp[n][j][j * a]

print(ans)


### FIXED CODE ###

def na(): return map(int, input().split())
n, a = na()
x = list(na())
xa = list(map(lambda f: f-a, x))
'''
dp[i][点数] = パターン数
i番目まで使用したときの点数になるパターン数
'''
dp = [dict() for _ in range(n)]
if xa[0] == 0:
    dp[0][0] = 2
else:
    dp[0][0] = 1
    dp[0][xa[0]] = 1
for i in range(1, n):
    #xa[i]を採用する / 採用しないで2つに分岐
    #すべて採用しないと点数0になるので、最後に点数0になったパターン数から1引く
    for k, v in dp[i-1].items():#k:得点, v:パターン数
        score = xa[i] + k
        dp[i][score] = dp[i].get(score, 0) + v#xa[i]を採用
        dp[i][k] = dp[i].get(k, 0) + v#xa[i]を不採用
print(dp[n-1][0] - 1)
N = int(input())
A = list(map(int, input().split()))
bottom = sum(A)

if A[0] >= 1:
  print(-1)
  exit()

ret = 1
children = 1

for i in range(N):
    children = children * 2 - A[i+1]
    if children <= -1:
      ret = -1
      break
    
    bottom -= A[i+1]
    if children >= bottom:
      children = bottom
    ret += children + A[i+1]
    print(children)
    print(bottom)
print(ret)

### FIXED CODE ###

h1, m1, h2, m2, k=map(int, input().split())

print((h2-h1)*60+(m2-m1)-k)
data = {
    'S':[0 for _ in range(13)],
    'H':[0 for _ in range(13)],
    'C':[0 for _ in range(13)],
    'D':[0 for _ in range(13)],
}
 
n = int(input())
for _ in range(n):
    (s, r) = input().split()
    index = cards[s].index(int(r))
    cards[s][int(r) - 1] = 1
  
for s in ['S', 'H', 'C', 'D']:
    for r in range(13):

        print(s, r)

### FIXED CODE ###

cards = {
        'S': [0 for _ in range(13)],
        'H': [0 for _ in range(13)],
        'C': [0 for _ in range(13)],
        'D': [0 for _ in range(13)],
        }
  
n = int(input())
for _ in range(n):
    (s, r) = input().split()
    r = int(r)
    cards[s][r - 1] = r
  
for s in ('S', 'H', 'C', 'D'):
    for r in range(13):
        if cards[s][r] == 0:
            print( '{0:s} {1:d}'.format(s, r+1))
def g_c_d(x, y):
    if x == 0:
        return y
    elif y == 0:
        return x
    else:
        return g_c_d(y, x % y)


def l_c_m(x, y):
    return x * y // g_c_d(x, y)


a, b = map(int, input().split())
c = input()
d = input()
f = l_c_m(a, b)
e = [""] * f
for i in range(0, 6):
    if i * f // a >= f - 1:
        break
    if e[i * f // a] == "":
        e[i * f // a] = c[i]
    elif e[i * f // a] != c[i]:
        print(-1)
        exit()
    if i * f // b >= f - 1:
        break
    if e[i * f // b] == "":
        e[i * f // b] = d[i]
    elif e[i * f // b] != d[i]:
        print(-1)
        exit()
print(f)


### FIXED CODE ###

def g_c_d(x, y):
    if x == 0:
        return y
    elif y == 0:
        return x
    else:
        return g_c_d(y, x % y)


def l_c_m(x, y):
    return x * y // g_c_d(x, y)


a, b = map(int, input().split())
c = input()
d = input()
lcm = l_c_m(a, b)
gcd = g_c_d(a, b)
for i in range(0, gcd):
    if c[i * a // gcd] != d[i * b // gcd]:
        print(-1)
        exit()
print(lcm)
a=int(input())
b=int(input())
c=0
while 1:
  a-=b
  c+=1
  if a<=0:
    break
  else:
    pass
print(c)

### FIXED CODE ###

a,b=map(int,input().split())
c=0
while 1:
  a-=b
  c+=1
  if a<=0:
    break
  else:
    pass
print(c)
import sys
import functools
from collections import deque

readline = sys.stdin.buffer.readline
n, m, k = map(int, readline().split())
a = list(map(int, readline().split()))
b = list(map(int, readline().split()))

a_len = len(a)
b_len = len(b)


ans = [0, 0, 0]

L = []
d = deque()
d.append((0, 0, 0))
while d:
    a_readed, b_readed, t = d.popleft()
    if not (a_len > a_readed and t + a[a_readed] <= k) and not (b_len > b_readed and t + b[b_readed] <= k):
        L.append(a_readed + b_readed)
    else:
        if a_len > a_readed and t + a[a_readed] <= k:
            d.append((a_readed + 1, b_readed, t + a[a_readed]))
        if b_len > b_readed and t + b[b_readed] <= k:
            d.append((a_readed, b_readed + 1, t + b[a_readed]))

ans = max(L)
print(ans)

### FIXED CODE ###

import sys
from itertools import accumulate


def _tsundoku(n, m, k, a, b):
    a_temp = tuple(accumulate(a, initial=0))
    b_temp = tuple(accumulate(b, initial=0))

    ans = 0
    b_index = m
    for a_index in range(n + 1):
        if a_temp[a_index] > k:
            break
        while a_temp[a_index] + b_temp[b_index] > k:
            b_index -= 1
        else:
            ans = max(ans, a_index + b_index)
    return ans


def tsundoku(f):
    readline = f.readline
    n, m, k = map(int, readline().split())
    a = list(map(int, readline().split()))
    b = list(map(int, readline().split()))

    return _tsundoku(n, m, k, a, b)


def main():
    ans = tsundoku(sys.stdin.buffer)
    print(ans)


if __name__ == '__main__':
    main()
N = int(input())
A = list(map(int, input().split()))
A_set = list(set(A))

Ad = {a_set:A.count(a_set) for a_set in A_set}

score_sum = sum([x*(x-1)/2 for x in list(Ad.values())]

for a in A:
    print(int(score_sum - (Ad[a] - 1)))


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))

# A_set = list(set(A))
# Ad = {a_set:A.count(a_set) for a_set in A_set}
Ad = {}
for i in A:
  if not i in Ad:
    Ad[i]=0
  Ad[i] += 1

score_sum = sum([x*(x-1)/2 for x in list(Ad.values())])

for a in A:
    print(int(score_sum - (Ad[a] - 1)))
#ABC072C
N=int(input())
A=list(map(int,input().split()))
max_A=max(A)
TGS=[0]*(max_A+1)
ans=0
for i in range(N):
    TGS[A[i]]+=1
for i in range(max_A):
    if ans<TGS[i]+TGS[i+1]+TGS[i+2]:
        ans=TGS[i]+TGS[i+1]+TGS[i+2]
print(ans)

### FIXED CODE ###

#ABC072C
N=int(input())
A=list(map(int,input().split()))
max_A=max(A)
TGS=[0]*(max_A+1)
ans=0
for i in range(N):
    TGS[A[i]]+=1
for i in range(max_A-1):
    if ans<TGS[i]+TGS[i+1]+TGS[i+2]:
        ans=TGS[i]+TGS[i+1]+TGS[i+2]
if max_A<2:
    ans=N
print(ans)
s = list(map(int, input().split()))
c = 0
if s[0] == 1:
  c = c+1
if s[1] == 1:
  c = c+1
if s[2] == 1:
  c = c+1
print(c)

### FIXED CODE ###

s = input()
cnt = 0
if s[0] == "1":
  cnt+=1
if s[1] == "1":
  cnt+=1
if s[2] == "1":
  cnt+=1
  
print(cnt)
import math
def main1():
    input_num = int(input())
    num_sqrt = int(math.sqrt(input_num))

    minimam = input_num
    for i in range(num_sqrt+1,0,-1):
        q, mod = divmod(input_num, i)
        if mod == 0:
            distance = q + i -2
            if minimam > distance:
            minimam = distance
    print(minimam)

### FIXED CODE ###

num = int(input())
minimam = 10**12
for i in range(1,10**6+1):
    q, mod = divmod(num, i)
    distance = q + i -2
    if mod == 0 and minimam > distance:
        minimam = distance
print(minimam)
s=input()
if s[2]==s[3] and s[4]==s[5]:
          print("Yes")
else:
          print("No"


### FIXED CODE ###

s=input()
if s[2]==s[3] and s[4]==s[5]:
    print("Yes")
else:
    print("No")
n = 5
num_list = [1,2,3,2,1]
count = 0
for i in range(len(num_list)-3):
	hoge = num_list[i:i+3].sort_values()
    if hoge[1] = num_list[1]:
      count += 1
 
print(count)
 

### FIXED CODE ###

if __name__ == '__main__':
  
  z = int(input())
  if 20 >= z and z >= 3:
    num_list = list(map(int, input().strip().split()))
    count = 0
    for i in range(z-2):
      hoge = num_list[i:i+3]
      hoge_sort = sorted(hoge)
      if hoge[1]==hoge_sort[1]:
        count += 1
    print(count)
N,K=map(int,input().split())
res=[0]*N
for i in range(1,N+1):
    res[i%K]=res[i%K]+1
#print(res)

if K%2==0:
    print(pow(res[K//2],3)+pow(res[0],3))
else:
    print(pow(res[0], 3))


### FIXED CODE ###

N,K=map(int,input().split())
res=[0]*K
for i in range(1,N+1):
    res[i%K]=res[i%K]+1
#print(res)

if K%2==0:
    print(pow(res[K//2],3)+pow(res[0],3))
else:
    print(pow(res[0], 3))
N,M = list(map(int, input().split()))
s = []
c = []
for i in range(M):
  inputs = list(map(int, input().split()))
  s.append(inputs[0])
  c.append(inputs[1])
  
res = [0 for i in range(N)]
for digit, number in zip(s,c):
    digit -= 1
    if not res[digit] == 0:
        if res[digit] <= number:
            res[digit] = numer
        else:
            continue
    res[digit] = number

convert = list(map(str, res))
res = int("".join(convert))
if convert[0] == 0:
    print(-1)
elif len(str(res)) == N:
    print(res)
else:
    print(-1)

### FIXED CODE ###

n = int(input())
def main(n):
  return n // 2 + n % 2
print(main(n))
from fractions import gcd

INF = 2 << 30
V = 1002
G = [[] for _ in xrange(V)]
visited = [False]*V

def add_edge(fro, to, cap):
    G[fro].append([to,cap,len(G[to])])
    G[to].append([fro,0,len(G[fro])-1])

def dfs(v,t,f):
    if v == t:
        return f
    visited[v] = True
    for i,(to,cap,rev) in enumerate((G[v])):
        if visited[to] or cap == 0:            
            continue        
        d = dfs(to,t,min(f,cap))
        if d > 0:
            G[v][i][1] -= d
            G[to][rev][1] += d
            return d
    return 0

def max_flow(s,t):
    flow = 0
    while True:
        for i in xrange(V):
            visited[i] = False
        f = dfs(s,t,INF)
        if f == 0:
            return flow
        flow += f

while True:
    m,n = map(int,raw_input().split())
    if m|n == 0:
        break
    V = m+n+2
    G = [[] for _ in xrange(V)]
    data = []
    while len(data) < n+m:
        data += map(int,raw_input().split())            
    blue = data[:m]
    red = data[m:]
    for i in xrange(m):
        add_edge(V-2,i,1)
    for i in xrange(m,m+n):
        add_edge(i,V-1,1)
    for i,b in enumerate(blue):
        for j,r in enumerate(red,m):
            if gcd(b,r) != 1:
                add_edge(i,j,1)
    print max_flow(V-2,V-1)

### FIXED CODE ###

from fractions import gcd

V = 1001
G = []
visited = []
match = []

def add_edge(u,v):
    G[u].append(v)
    G[v].append(u)

def dfs(v):
    visited[v] = True
    for u in G[v]:
        w = match[u]
        if w < 0 or not visited[w] and dfs(w):
            match[v] = u
            match[u] = v
            return True

def bipartite_matching():
    global match,visited
    res = 0
    match = [-1]*V
    for v in xrange(V):
        if match[v] < 0:
            visited = [False]*V
            if dfs(v):
                res += 1
    return res

while True:
    m,n = map(int,raw_input().split())
    V = m+n
    if V == 0:
        break
    G = [[] for _ in xrange(V)]
    data = []
    while len(data) < V:
        data += map(int,raw_input().split())
    for i,b in enumerate(data[:m]):
        for j,r in enumerate(data[m:],m):
            if gcd(b,r) != 1:
                add_edge(i,j)
    print bipartite_matching()
def main():

#---------------------------------------------------------

N = int(input())
ans = 0
for i in range(1, N + 1):
    n = N // i  # 項数n
    cnt = (n * (2 * i + (n - 1) * i)) // 2  # 初項i, 項数n の等差数列の和の公式
    ans += cnt
print(ans)

#---------------------------------------------------------

if __name__ == '__main__':
   main()

### FIXED CODE ###

N = int(input())
ans = 0
for i in range(1, N + 1):
    n = N // i  # 項数n
    cnt = (n * (2 * i + (n - 1) * i)) // 2  # 初項i, 項数n の等差数列の和の公式
    ans += cnt
print(ans)
if n < 1200:
    print('ABC')
elif n < 2800:
    print('ARC')
else:
    print('AGC')

### FIXED CODE ###

n = int(input())
if n < 1200:
    print('ABC')
elif n < 2800:
    print('ARC')
else:
    print('AGC')