Harryxun/stf_run huggingface dataset:
n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[]
  y=[]
  for j in range(a):
    x,y=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
c=0
for i in range(n):
  l=[1]*n
  for j in range(i, n-i):
    #if l[j]==0:continue
    for k in range(A[j]):
      #b=X[j][k]
      #l[b] *= Y[j][k]
if c<l.count(1):
  c=l.count(1) 
  
        
  
print(c)  
   

### FIXED CODE ###

n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[0]*a
  y=[0]*a
  for j in range(a):
    x[j],y[j]=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
s=0
for i in range(2**n):
  c=0
  d=0
  B=[0]*n
  for j in range(n):
    if((i >> j) & 1):
      c=c+1
      B[j]=1
  for k in range(n):
    if B[k]==1:
      for j in range(A[k]):
        if Y[k][j]!=B[X[k][j]-1]:
          d=-1
          break
    if d<0:
      break
  if s<c and d==0:
    s=c
      
      
print(s)
n,k = (int(x) for x in input().split())
a = [int(x) for x in input().split()]

l = [1]
now = 1
next = a[0]
count = 0
dupl = a[-1]

for i in range(k):
  now = next
  next = a[now-1]
  
  if now in l:
    dupl = now
    break
  else:
    l.append(now)
    
count = l.index(dupl)
length = len(l)-count
print(l[(k-count)%length+count])

### FIXED CODE ###

n,k = (int(x) for x in input().split())
a = tuple([int(x) for x in input().split()])
 
c = [0] + [-1]*(n)
l = [1]
now = 1
dupl = -1

for i in range(k):
  now = a[now - 1]
  c[now - 1] += 1
   
  if c[now - 1] == 1:
    dupl = now
    break
  else:
    l.append(now)
    
if dupl == -1:
  print(now)
  exit()
       
notloop = l.index(dupl)
length = len(l)-notloop
print(l[(k-notloop)%length+notloop])
# coding: utf-8
# Your code here!

N = int(input())
a_list=[]
b_list=[]
for i in range(N-1):
    ab = list(map(int,input().split()))
    a_list.append(ab[0])
    b_list.append(ab[1])

graph = [[] for i in range(N)]
for i in range(N-1):
    graph[a_list[i]-1].append((b_list[i],i))
    graph[b_list[i]-1].append((a_list[i],i))
    
ans = [0 for i in range(N-1)]
ten_col = [[] for i in range(N)]
def dfs(start,now):
    for (future,i) in graph[now-1]:
        if future == start:
            pass
        else:
            new_col = 1
            while True:
                if new_col not in ten_col[now-1]:
                    ten_col[now-1].append(new_col)
                    ten_col[future-1].append(new_col)
                    ans[i] = new_col
                    break
                else:
                    new_col += 1
            dfs(now,future)
            
dfs(-1,1)
print(max(ans))
for i in ans:
    print(i)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

N = int(input())

graph = [[] for i in range(N)]

for i in range(N-1):
    a,b = map(int,input().split())
    graph[a-1].append((b,i))
    graph[b-1].append((a,i))
    
ans = [0]*(N-1)

def dfs(past,now,edge_col):
    new_col = 1
    for (future,i) in graph[now-1]:
        if future == past:
            pass
        else:
            if new_col == edge_col:
                new_col += 1
            ans[i] = new_col
            dfs(now,future,new_col)
            new_col += 1
            
dfs(-1,1,-1)

print(max(ans))
for i in ans:
    print(i)
import sys, math
input = sys.stdin.readline

S = list(input().replace('\n',''))
S = map(int, S)
prev = S[0]
ans = 0
for i in range(1, len(S)-1):
  cur = S[i]
  if prev ^ cur == 0:
    ans += 1
    prev = 2 + ~cur
  else:
    prev = cur

print(ans)

### FIXED CODE ###

import sys, math
input = sys.stdin.readline

S = list(input().replace('\n',''))
S = list(map(int, S))
prev = S[0]
ans = 0
for i in range(1, len(S)):
  cur = S[i]
  if prev ^ cur == 0:
    ans += 1
#     if i == 1:
#       if cur ^ S[i+1] == 1:
#         prev = cur
#       else:
#         prev = 2 + ~cur
#     else:
    prev = 2 + ~cur
  else:
    prev = cur

print(ans)
a, b = int(input().split())
m = a + b
m = m < a - b if m = a - b else m
m = m < a * b if m = a * b else m
print(m)

### FIXED CODE ###

a,b=map(int,input().split())
print(max(a+b,a-b,a*b))
N, M = map(int, raw_input().split())

for i in range(M/N+1, 0, -1):
    if M % i == 0:
        print i



### FIXED CODE ###

N, M = map(int, input().split())

output = 1
for i in range(M//N, 0, -1):
    if M % i == 0 and output < i:
        output = i
        break
print(output)
n,y = map(int,input().split())
s=[-1,-1,-1]
if n*10000<y:
    pass
else:
    m=0
    x=n*10000
    while m<=n:
        for i in range(m):
            x= x-9000*(m-i)-4000*i
            if x == y:
                s=[n-m,i,m-i]
                break
        if x==y:
            break
print(*l)
                

### FIXED CODE ###

n,y = map(int,input().split())
s=[-1,-1,-1]
if n*10000<y:
    pass
elif n*10000==y:
    s=[n,0,0]
else:
    m=1
    x_0=n*10000
    while m<=n:
        for i in range(m+1):
            x= x_0-9000*(m-i)-5000*i
            if x == y:
                s=[n-m,i,m-i]
                break
        if x==y:
            break
        m=m+1
print(*s)
n=input()
a,b=map(int,input().split())
if n=="1":
  print("Hello World")
elif n=="2":
  print(a+b)


### FIXED CODE ###

n=int(input())
if n==1:
  print("Hello World")
else:
  a=int(input())
  b=int(input())
  print(a+b)
a = input().split()

if int(a[0])<=int(a[1]) and int(a[0])<=int(a[2]):
  min = int(a[0])
  if int(a[1])<=int(a[2]):
    max = int(a[2])
  else:
    max = int(a[1])
elif int(a[1])<=int(a[2]) and int(a[1])<=int(a[0]):
  min = int([1])
  if int(a[0])<=int(a[2]):
    max = int(a[2])
  else:
    max = int(a[0])
else:
  min = int(a[2])
  if int(a[0])<=int(a[1]):
    max = int(a[1])
  else:
    max = int(a[0])

print(max-min)

### FIXED CODE ###

a = input().split()

if int(a[0])<=int(a[1]) and int(a[0])<=int(a[2]):
  min = int(a[0])
  if int(a[1])<=int(a[2]):
    max = int(a[2])
  else:
    max = int(a[1])
elif int(a[1])<=int(a[2]) and int(a[1])<=int(a[0]):
  min = int(a[1])
  if int(a[0])<=int(a[2]):
    max = int(a[2])
  else:
    max = int(a[0])
else:
  min = int(a[2])
  if int(a[0])<=int(a[1]):
    max = int(a[1])
  else:
    max = int(a[0])

print(max-min)
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

D = 0
cnt = 0
while D <= X:
    D += A[cnt]
    cnt += 1

print(cnt)

### FIXED CODE ###

import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

D = 0
cnt = 0
while D <= X and cnt <= N:
    if cnt != N:
        D += A[cnt]
    cnt += 1

print(cnt)
val = 0
for s in input():
  if(s == '+'):
    val++
  else:
    val--
print(val)

### FIXED CODE ###

val = 0
for s in list(input()):
  if(s == "+"):
    val+=1
  else:
    val-=1
print(val)
N = int(input())
H = list(map(int, input().split()))
ans = 0
max = H[1]
for i in range(N-1):
  if H[i+1] >= max:
    ans += 1
    max = H[i+1]
print(ans+1)

### FIXED CODE ###

a,b = map(int, input().split())
if a>b:
  ans = 2*a-1
elif a==b:
  ans = 2*a
else:
  ans = 2*b-1
  
print(ans)
S,T = map(str,input().split())
if T[:-1]  == S :
    print ('Yes')
else :
    print ('No')
#st = st[:-1]



### FIXED CODE ###

a  =input()
b =input()
c = 0
for i in range(len(a)):
	if a[i] != b[i]:
		c = 1
      
if c ==0:
	print("Yes")
else:
	print("No")
x, y, z, k = list(map(int, input().split()))
a = sorted(list(map(int, input().split())), reverse = True)
b = sorted(list(map(int, input().split())), reverse = True)
c = sorted(list(map(int, input().split())), reverse = True)
d = min(x*y*z, 3000)
dp = [0] * max(x*y*z, 3000)
count = 0
for i in range(x):
    for j in range(y):
        for t in range(z):
            dp[count] = a[i] + b[j] +  c[t]
            count += 1

dp = sorted(dp, reverse = True)

for i in range(k):
    print(dp[i])

### FIXED CODE ###

x,y,z,k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse = True)
b.sort(reverse = True)
c.sort(reverse = True)
li = []
box = []
for i in a:
    for j in b:
        li.append(i + j) 
li.sort(reverse = True)
li = li[:min(k,x*y)]
for i in c:
    for j in li:
        box.append(i + j)
box.sort(reverse = True)
for i in range(k):
    print(box[i])
a,b = map(int,input().split())
ans_li = [0 for x in range(a)]

for i in range(b):
  d = int(input())
  for j in range(d):
    l = list(map(int, input().split()))
    for ll in l:
      ans_li[ll-1] += 1
print(ans_li.count(0))


### FIXED CODE ###

a,b = map(int,input().split())
ans_li = [0 for x in range(a)]

for i in range(b):
  d = int(input())
  l = list(map(int, input().split()))
  for ll in l:
      ans_li[ll-1] += 1
print(ans_li.count(0))
nums = input().split()

i = 0
while i < nums.length:
    print( Case, i, nums[i])
    i += 1

### FIXED CODE ###

count = 1
while True:
    x = input().strip()
    if x == '0':
        break
    else:
        print( 'Case %s: %s' % ( count, x))
        count += 1
N = int(input())
H = list(map(int, input().split()))
ans = [0]*N
for i in range(1,N):
  if H[i - 1] <= now_:
    ans[i] = ans[i - 1] + 1
print(max(ans))

### FIXED CODE ###

import math
N = int(input())
H = list(map(int, input().split()))
ans = [0]*N
for i in range(1,N):
  if H[i] <= H[i - 1]:
    ans[i] = ans[i - 1] + 1
print(max(ans))
a = []
i = 0 //????????????

while True:
	n = input()
	if n == 0:
		break
	i += 1//?????????????????????
	print("Case {0} : {1}".format([i,n]))

### FIXED CODE ###


i = 0 #????????????

while True:
	n = input()
	if n == '0':
		break
	i += 1#?????????????????????
	print('Case {}: {}'.format(i,n))
n=input()
 a=map(int,raw_input().split())
 a=reverse()

for i in range(n)
     print a[i]

### FIXED CODE ###

n=input()
a=map(int,raw_input().split())
a.reverse()

for i in a:
    print i,
N = int(input())
listH =  list(map(int, input().split()))
count_lr = 0
li_lr = []

for i in range(N-1):
    if listH[i] >= listH[i+1]:
        count_lr += 1
        li_lr.append(count_lr)
    else:
        count_lr = 0
        li_lr.append(count_lr)
        
print(max(li_lr))

### FIXED CODE ###

N = int(input())
listH =  list(map(int, input().split()))
val = 0
ans = 0

for i in range(N-1):
    if listH[i] >= listH[i+1]:
        val += 1
    else:
        val = 0
    ans = max(val,ans)
        
print(ans)
N,A,B,C=map(int,input().split())
*S,=open(0).read().split()

ans='Yes'
L_ans=['']*N
i=0
while i<N:
    if S[i]=='AB':
        if A>=B:
            B+=1
            A-=1
            L_ans[i]='B'
        else:
            A+=1
            B-=1
            L_ans[i]='A'
    elif S[i]=='AC':
        if A>=C:
            C+=1
            A-=1
            L_ans[i]='C'
        else:
            A+=1
            C-=1
            L_ans[i]='A'
    elif S[i]=='BC':
        if C>=B:
            B+=1
            C-=1
            L_ans[i]='B'
        else:
            C+=1
            B-=1
            L_ans[i]='C'
    i+=1
    if any([A<0,B<0,C<0]):
        ans='No'
        break

print(ans)
if ans=='Yes':
    for j in L_ans:
        print(j)

### FIXED CODE ###

N,A,B,C=map(int,input().split())
S=['']*(N+1)
for a in range(N):
    S[a]=input()

ans='Yes'
L_ans=['']*(N+1)
i=0
while i<N:
    if S[i]=='AB':
        if A>B:
            B+=1
            A-=1
            L_ans[i]='B'
        elif A<B:
            A+=1
            B-=1
            L_ans[i]='A'
        elif A==B and S[i+1]=='BC':
            B+=1
            A-=1
            L_ans[i]='B'
        else:
            A+=1
            B-=1
            L_ans[i]='A'
    elif S[i]=='AC':
        if A>C:
            C+=1
            A-=1
            L_ans[i]='C'
        elif A<C:
            A+=1
            C-=1
            L_ans[i]='A'
        elif A==C and S[i+1]=='BC':
            C+=1
            A-=1
            L_ans[i]='C'
        else:
            A+=1
            C-=1
            L_ans[i]='A'
    elif S[i]=='BC':
        if C>B:
            B+=1
            C-=1
            L_ans[i]='B'
        elif C<B:
            C+=1
            B-=1
            L_ans[i]='C'
        elif B==C and S[i+1]=='AB':
            B+=1
            C-=1
            L_ans[i]='B'
        else:
            C+=1
            B-=1
            L_ans[i]='C'
    i+=1
    if any([A<0,B<0,C<0]):
        ans='No'
        break

print(ans)
if ans=='Yes':
    j=0
    while j<N:
        print(L_ans[j])
        j+=1
for i in range(1:10):
	for j in range(1:10):
		print "%dx%d=%d" % (i, j, i*j)

### FIXED CODE ###

#coding: UTF-8

for i in range(1, 10):
	for j in range(1, 10):
		print "%dx%d=%d" % (i, j, i*j)
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    s = input()
    S = list(s)
    A = list(reversed(list("zyxwvutsrqponmlkjihgfedcba")))
    for i in range(26):
        if A[i] not in S:
            S.append(A[i])
            print(*S, sep="")
            return
    else:
        A = []
        for s in S:
            A.append(ord(s))
        for i in range(25):
            if A[25 - i] > A[25 - i - 1]:
                continue
            else:
                k = 25 - i - 1
        if k == 0:
            print(-1)
            return
        S = S[: k - 1]
        S.append(chr(min(A[k:])))
        print(*S, sep="")


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    S = input()
    A = set(chr(ord("a") + x) for x in range(26))
    if len(S) < 26:
        se = A - set(S)
        x = min(se)
        print(S + x)

    else:
        if S == "".join(sorted(A, reverse=True)):
            print(-1)
            return
        else:
            c = []
            S = list(S)
            while True:
                x = S[-1]
                if not c or (x > max(c)):
                    c.append(S.pop())
                    continue
                y = min(ch for ch in c if ch > x)
                S = "".join(S[:-1]) + y
                print(S)
                return


if __name__ == "__main__":
    main()
n = int(raw_input())
S = map(int, raw_input().split())
S = sorted(S)

q = int(raw_input())
T = map(int, raw_input().split())
T = sorted(T)

i = 0
count = 0

while i < q:
    j = 0
    while j < n:
        if j != n - 1:
            while S[j] == S[j + 1]:
                j += 1
        
        if T[i] == S[j]:
            count += 1

        if T[i] < S[j]:
            break
        
        j += 1
    i += 1

print count

### FIXED CODE ###

n = int(raw_input())
S = map(int, raw_input().split())
S = sorted(S)

q = int(raw_input())
T = map(int, raw_input().split())
T = sorted(T)

count = 0
j = 0

for i in range(q):
    for j in range(n):
        if T[i] == S[j]:
            count += 1
            break

print count
N=input()
s=input()
K=int(input())

t=s[K-1]
for i in range(N):
    if s[i]!=t:
        S[i]="*"
print("".join(s))


### FIXED CODE ###

N=int(input())
s=list(input())
K=int(input())
t=s[K-1]
for i in range(N):
    if s[i]!=t:
        s[i]="*"
print("".join(s))
S = input()
N = int(input())

pre = ""
suf = ""
f = 1
for i in range(N):
  Q = input()
  if Q[0] == "1":
    f *= -1
  elif Q[2] == "1":
    if f > 0:
      pre = Q[4] + pre
    else:
      suf = sef + Q[4]
  else:
    if f < 0:
      pre = Q[4] + pre
    else:
      suf = sef + Q[4]

ans = pre + S + suf
if f > 0:
  print(ans)
else:
  print(ans[::-1])

### FIXED CODE ###

S = input()
N = int(input())

pre = ""
suf = ""
f = 1
for i in range(N):
  Q = input()
  if Q[0] == "1":
    f *= -1
  elif Q[2] == "1":
    if f > 0:
      pre = Q[4] + pre
    else:
      suf = suf + Q[4]
  else:
    if f < 0:
      pre = Q[4] + pre
    else:
      suf = suf + Q[4]

ans = pre + S + suf
if f > 0:
  print(ans)
else:
  print(ans[::-1])
def main():
    import sys
    input = lambda:sys.stdin.readline().rstrip()
    
    def Warshall_Floyd(d):
        for k in range(n):
            for i in range(n):
                for j in range(n):
                    d[i][j] = min(d[i][j], d[i][k]+d[k][j])
        return d

    n, m, l = map(int, input().split())
    f_inf = float('inf')
    dist = [[f_inf]*n for _ in range(n)]

    for i in range(m): dist[i][i] = 0
    for _ in range(m):
        a, b, c = map(int, input().split())
        dist[a-1][b-1] = c
        dist[b-1][a-1] = c

    Warshall_Floyd(dist)

    dist2 = [[f_inf]*n for _ in range(n)]
    for i in range(n):
        for j in range(n):
            if dist[i][j] <= l:
                dist2[i][j] = 1
    Warshall_Floyd(dist2)

    q = int(input())
    for _ in range(q):
        s, t = map(int, input().split())
        ans = dist2[s-1][t-1]
        if dist2[s-1][t-1] == f_inf:
            print(-1)
        else:
            print(ans-1)
if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    N, M, L = map(int, input().split())
    dist = [[float('inf')] * N for _ in range(N)]
    for _ in range(M):
        A, B, C = map(int, input().split())
        if C > L:
            continue
        A -= 1
        B -= 1
        dist[A][B] = C
        dist[B][A] = C

    for k in range(N):
        for i in range(N):
            for j in range(N):
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])

    e = [[float('inf')] * N for _ in range(N)]
    for i in range(N):
        for j in range(N):
            if dist[i][j] <= L:
                e[i][j] = 1
    
    for k in range(N):
        for i in range(N):
            for j in range(N):
                e[i][j] = min(e[i][j], e[i][k] + e[k][j])


    Q = int(input())
    for _ in range(Q):
        s, t = map(int, input().split())
        s -= 1
        t -= 1
        if e[s][t] == float('inf'):
            print(-1)
            continue
        ans = e[s][t]
        print(ans-1)


if __name__ == "__main__":
    main()
import sys
input = sys.stdin.readline

def main():
    x = int(input())

    for b in range(10**9):
        y = ((x + (-1*b)**5)**(1/5)).is_integer()
        if y:
            print(int((x + (-1*b)**5)**(1/5)), -1*b)
            break


if __name__ == '__main__':
    main()


### FIXED CODE ###

X = int(input())
C= [i**5 for i in range(120)]

a = 0
b = 0

for a in range(len(C)):
    for b in range(len(C)):
        if C[a] + C[b] == X:
            print(a, -b)
            exit(0)
        elif C[a] - C[b] == X:
            print(a, b)
            exit(0)
n, m = map(int, input().split())
li = [list(map(int, input().split()))for i in range(n)]

a = 0
b = 0
c = 0
review = abs(a) + abs(b) + abs(c)
for i in range(m):
    a += li[i][0]
    b += li[i][1]
    c += li[i][2]

review = abs(a) + abs(b) + abs(c)
flag = True

while True:
    flag = True
    for i in range(m):
        for j in range(n-m):
            x = li[i]
            li[i] = li[m+j]
            li[m+j] = x
            a = 0
            b = 0
            c = 0
            for k in range(m):
                a += li[k][0]
                b += li[k][1]
                c += li[k][2]
            if review < abs(a) + abs(b) + abs(c):
                review = abs(a) + abs(b) + abs(c)
                flag = False
    if flag:
        break
    else:
        continue
print(review)


### FIXED CODE ###

a, b = map(int, input().split())

if a >= 9 or b >= 9:
    print(":(")
else:
    print("Yay!")
num_list = []
while True:
    element = input()
    if element is None:
        break

    if element == '':
        break

    num_list.append(int(element))

limit = num_list[-1]

ans_string = "Yay!"
# for i in range(len(num_list) - 1):
#     print(num_list[i + 1] - num_list[i])
#     if num_list[i + 1] - num_list[i] > limit:
#         ans_string = ":("

for i in range(len(num_list) - 1):
    for j in range(i, len(num_list) - 1):
        if num_list[j] - num_list[i] > limit:
            ans_string = ":("

print(ans_string)


### FIXED CODE ###

num_list = []
while True:
    try:
        element = input()
    except EOFError:
        break

    num_list.append(int(element))

limit = num_list[-1]

ans_string = "Yay!"
# for i in range(len(num_list) - 1):
#     print(num_list[i + 1] - num_list[i])
#     if num_list[i + 1] - num_list[i] > limit:
#         ans_string = ":("

for i in range(len(num_list) - 1):
    for j in range(i, len(num_list) - 1):
        if num_list[j] - num_list[i] > limit:
            ans_string = ":("

print(ans_string)
N = int(input())
lst_a = list(map(int, input().split()))
lst_color = [0] * 8
cnt_super = 0


for a in lst_a:
    i = a // 400
    if i == 8:
        cnt_super += 1
    else:
        lst_color[i] = 1
cnt_existed = sum(1 for x in lst_color if x!=0)


ans_min = max(cnt_existed, 1)
ans_max = cnt_existed + cnt_super


print(ans_min, ans_max)

### FIXED CODE ###

N = int(input())
lst_a = list(map(int, input().split()))
lst_color = [0] * 8
cnt_super = 0


for a in lst_a:
    if 1 <= a <= 399:
        lst_color[0] += 1
    elif 400 <= a <= 799:
        lst_color[1] += 1
    elif 800 <= a <= 1199:
        lst_color[2] += 1
    elif 1200 <= a <= 1599:
        lst_color[3] += 1
    elif 1600 <= a <= 1999:
        lst_color[4] += 1
    elif 2000 <= a <= 2399:
        lst_color[5] += 1
    elif 2400 <= a <= 2799:
        lst_color[6] += 1
    elif 2800 <= a <= 3199:
        lst_color[7] += 1
    else:
        cnt_super += 1
cnt_existed = sum(1 for x in lst_color if x!=0)


if cnt_existed == 0:
    ans_min = 1
    ans_max = cnt_super
else:
    ans_min = cnt_existed
    ans_max = cnt_existed + cnt_super


print(ans_min, ans_max)
n = int(input())
a = sorted(list(map(int, input().split())))
c0 = a.count(0)

ans = "No"
if c0==n: ans = "Yes"
elif len(set(a)) == 2:
    c = a.count(set(a)[-1])
    if c == (2*n)//3 and c0 == n//3: ans = "Yes"
elif len(set(a)) == 3:
    x,y,z = list(set(a))
    if int(bin(x ^ y ^ z),2) == 0: ans = "Yes"
print(ans)

### FIXED CODE ###

n = int(input())
a = sorted(list(map(int, input().split())))
c0 = a.count(0)

ans = "No"
if c0==n: ans = "Yes"
elif len(set(a)) == 2:
    c = a.count(a[-1])
    if c == (2*n)//3 and c0 == n//3: ans = "Yes"
elif len(set(a)) == 3:
    x,y,z = list(set(a))
    if a.count(x) == a.count(y) == a.count(z):
        if int(bin(x ^ y ^ z),2) == 0: ans = "Yes"
print(ans)
import math
N = int(input())

ans = 0

for i in range(int(math.log(N,5))):
    ans += N//(5**(i+1)*2)
print(ans)

### FIXED CODE ###

import math
N = int(input())

ans = 0

if N%2==1:ans=0
else:
    for i in range(int(math.log(N+1,5))):
        ans += N//(5**(i+1)*2)
print(ans)
import sys
sys.setrecursionlimit(100000)

N,Q=map(int,input().split())

tree_list=[]
for i in range(N+1):
  tree_list.append([])

for i in range(N-1):
  a,b=map(int,input().split())
  tree_list[a].append(b)
  
dic_score={}
for i in range(Q):
  p,x=map(int,input().split())
  if p in dic_score:
    dic_score[p]+=x
  else:
    dic_score[p]=x

#print(tree_list)  
ans_list=[0]*(N+1)

def dfs(v,s):
  score=s
  if v in dic_score:
    score+=dic_score[v]
    
  ans_list[v]+=score
  for vv in tree_list[v]:
    dfs(vv,score)

dfs(1,0)
#print(ans_list)

ans_list_str=[]
for i in range(1,N+1):
  ans_list_str.append(str(ans_list[i]))

print(" ".join(ans_list_str))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
input=sys.stdin.readline

def dfs(u,par):
  ans_list[u]+=ans_list[par]  
  for v in tree_list[u]:
    if v!=par:
      dfs(v,u)      
  return

N,Q=map(int,input().split())

tree_list=[[] for _ in range(N+1)]
for i in range(N-1):
  a,b=map(int,input().split())
  tree_list[a].append(b)
  tree_list[b].append(a)
#print(tree_list)

ans_list=[0]*(N+1)
for i in range(Q):
  p,x=map(int,input().split())
  ans_list[p]+=x

dfs(1,0)

print(*ans_list[1:])
a,b,c =int(input())
if a == b:
  print(c)
elif  b == c:
  print(a)
else:
  print(b)

### FIXED CODE ###

a,b,c =map(int,input().split())
if a == b:
  print(c)
elif  b == c:
  print(a)
else:
  print(b)
r = int(input())
if a < 1200:
  print("ABC")
elif a < 2800:
  print("ARC")
else:
  print("AGC")

### FIXED CODE ###

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