Harryxun/stf_run huggingface dataset:
from collections import deque
n = int(input())
e = [[] for _ in range(n)]
AB = [list(map(int, input().split())) for _ in range(n - 1)]
AB = [(a -1, b - 1) for a, b in AB]

for itr, (a, b) in enumerate(AB):
  e[a].append(b)
  e[b].append(b)
  
colors = [-1] * n

# ２色で塗分けする。
q = deque()
# 現在見ている頂点、親の色
q.append((0, 0))
while q:
  v, pcol = q.popleft()
  # 親と異なる色で塗る。
  if colors[v] == -1:
    col = not pcol
    colors[v] = col
    for i in e[v]:
      if colors[i] == -1:
        q.append((i, col))

m1 = deque([i for i in range(1, n + 1) if i % 3 == 1])
m2 = deque([i for i in range(1, n + 1) if i % 3 == 2])
m0 = deque([i for i in range(1, n + 1) if i % 3 == 0])

ans = [0] * n

for itr, i in enumerate(colors):
  if i:
    if m1:
      ans[itr] = m1.pop()
    else:
      ans[itr] = m0.pop()
  else:
    if m2:
      ans[itr] = m2.pop()
    else:
      ans[itr] = m0.pop()

print(*ans)

### FIXED CODE ###

from collections import deque
n = int(input())
e = [[] for _ in range(n)]
AB = [list(map(int, input().split())) for _ in range(n - 1)]
AB = [(a -1, b - 1) for a, b in AB]

for itr, (a, b) in enumerate(AB):
  e[a].append(b)
  e[b].append(a)
  
colors = [-1] * n

# ２色で塗分けする。
q = deque()
# 現在見ている頂点、親の色
q.append((0, 0))
while q:
  v, pcol = q.popleft()
  # 親と異なる色で塗る。
  if colors[v] == -1:
    col = not pcol
    colors[v] = col
    for i in e[v]:
      if colors[i] == -1:
        q.append((i, col))

# print(e)
# print(colors)
        
m = [deque([i for i in range(1, n + 1) if i % 3 == j]) for j in range(3)]

# print(m)

def opop(n, ne):
  if m[n]:
    p = m[n].pop()
  else:
    if n == 1 or n == 2:
      if m[ne]:
        p = m[ne].pop()
      else:
        p = m[0].pop()
    else:
      if m[1]:
        p = m[1].pop()
      else:
        p = m[2].pop()
  return p

ans = [0] * n

if sum(colors) <= len(m[0]):
  for itr, i in enumerate(colors):
    if i:
      ans[itr] = opop(0, 0)
    else:
      ans[itr] = opop(1, 2)
elif sum(colors) >= len(m[1]) + len(m[2]):
  for itr, i in enumerate(colors):
    if not i:
      ans[itr] = opop(0, 0)
    else:
      ans[itr] = opop(1, 2)
else:
  for itr, i in enumerate(colors):
    if i:
      ans[itr] = opop(1, 0)
    else:
      ans[itr] = opop(2, 0)
print(*ans)
N = int(input())
H = list(map(int,input().split()))
H = [0]+H+[0]
for i in range(N,0,-1):
  if H[i-1]<=H[i]<=H[i+1]:
    H.pop(i)
  if H[i-1]>=H[i]>=H[i+1]:
    H.pop(i)
cnt = 0
flg = True
while flg:
  m = max(H)
  if m == 0:
    break
  i = H.index(m)
  d = min(H[i]-H[i+1], H[i]-H[i-1])
  cnt += d
  H[i+1]=max(0,H[i+1]-d)
  H[i-1]=max(0,H[i-1]-d)
  H.pop(i)
print(cnt)

### FIXED CODE ###

N = int(input())
H = list(map(int,input().split()))
H = [0]+H+[0]
def trm(li):
  for i in range(len(li)-2,0,-1):
    if li[i-1]<=li[i]<=li[i+1]:
      li.pop(i)
    elif li[i-1]>=li[i]>=li[i+1]:
      li.pop(i)
  return H
H = trm(H)
cnt = 0
for i in range(max(H),0,-1):
  flg = False
  for j in range(len(H)):
    if H[j]==i:
      if not flg:
        cnt +=1
        flg = True
      H[j]=H[j]-1
    else:
      flg = False
print(cnt)
INPUT = input().split()
H = INT(INPUT[0])
A = INT(INPUT[1])
print(H//A)

### FIXED CODE ###

INPUT = list(input().split())
H = int(INPUT[0])
A = int(INPUT[1])
if H%A == 0:
  print(H//A)
else:
  print(H//A + 1)
c = raw_input()

if "c" == a or e or i or o or u:
  print ("vowel")
else:
  print ("consonant")

### FIXED CODE ###

c = input()

if c == "a" :
  print ("vowel")
elif c == "e" :
  print ("vowel")
elif c == "i" :
  print ("vowel")
elif c == "o" :
  print ("vowel")
elif c == "u" :
  print ("vowel")
else:
  print ("consonant")
def ls_devider(num):
    fs = set()
    fs.add(1)

    if num > 1:
        for i in range(2, num):
            if num % i == 0:
                fs.add(i)

    return fs


a, b, k = map(int, input().split(' '))
a_dvs = ls_devider(a)
b_dvs = ls_devider(b)

print(sorted(a_dvs&b_dvs)[k-1])




### FIXED CODE ###

def ls_devider(num):
    fs = set()
    fs.add(1)

    if num > 1:
        for i in range(2, num+1):
            if num % i == 0:
                fs.add(i)

    return fs


a, b, k = map(int, input().split(' '))
a_dvs = ls_devider(a)
b_dvs = ls_devider(b)

print(sorted(a_dvs&b_dvs, reverse=True)[k-1])
S = input()
h = S // 3600
m = S % 3600 //60
s = S % 3600 % 60
print str(h), ':', str(m), ':', str(t)

### FIXED CODE ###

S = input()
h = S // 3600
m = S % 3600 //60
s = S % 3600 % 60
print str(h) + ':' + str(m) + ':' + str(s)
n = int(input())
if str(n[0]) == str(n[2]):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n = input()
if n[0] == n[-1]:
    print('Yes')
else:
    print('No')
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i],y[i] = map(int,input().split())

memo = {}

for i in range(N-1):
    for j in range(i+1,N):
        dx = x[j] - x[i]
        dy = y[j] - y[i]
        if ((dx,dy) in memo) or ((-dx,-dy) in memo):
            memo[(dx,dy)] += 1
        else:
            memo[(dx,dy)] = 1

M = max(memo.values())

print(N-M)


### FIXED CODE ###

N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i],y[i] = map(int,input().split())

if N == 1:
    print(1)
else:
    memo = {}

    for i in range(N-1):
        for j in range(i+1,N):
            dx = x[j] - x[i]
            dy = y[j] - y[i]
            if (dx,dy) in memo:
                memo[(dx,dy)] += 1
            elif (-dx,-dy) in memo:
                memo[(-dx,-dy)] += 1
            else:
               memo[(dx,dy)] = 1
            #print(memo)

    M = max(memo.values())

    print(N-M)
A=[list(map(int,input().split())) for i in range(3)]
n=int(input())

for i in range(n):
  o=int(input())
  for x in range(3):
    for y in range(3):
      if o == A[x][y]:
        A[x][y]=-1
for x in range(3):
  if A[x][0]==-1:
    f=True
    for y in range(3):
      if A[x][y]!=-1:
        f=False
    if f:
      print('Yes')
      exit()
for y in range(3):
  if A[0][y] == -1:
    f=True
    for x in range(3):
      if A[y][[x] != -1:
        f=False
    if f:
      print('Yes')
      exit()
f=True
for i in range(3):
  if A[i][i]!=-1:
    f=False
if f:
  print('Yes')
f=True
for i in range(1,3):
  if A[-i][-i]!=-1:
    f=False
if f:
  print('Yes')


### FIXED CODE ###

A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())

for _ in range(N):
    b = int(input())
    for y in range(3):
        for x in range(3):
            if A[y][x] == b:
                A[y][x] = -1

for y in range(3):
    f = True
    for x in range(3):
        if A[y][x] != -1:
            f = False
    if f:
        print('Yes')
        exit()

for x in range(3):
    f = True
    for y in range(3):
        if A[y][x] != -1:
            f = False
    if f:
        print('Yes')
        exit()

f = True
for x in range(3):
    if A[x][x] != -1:
        f = False
if f:
    print('Yes')
    exit()

f = True
for x in range(3):
    if A[2 - x][x] != -1:
        f = False
if f:
    print('Yes')
    exit()

print('No')
a,b = map(int,input().split)
if(a*b)%2:
    print("Odd")
else:
    print("Even")


### FIXED CODE ###

a,b = map(int,input().split())
if(a*b)%2:
    print("Odd")
else:
    print("Even")
import math
A, B, N = list(map(int, input().split()))
ans = 0
if B+1 < N:
    C = B+1
else:
    C = N
if B//A == 0:
    D = 1
elif B//A > 1:
  	D = B//A-0.1
else:
    D = B//A
for i in range(1, C+1, D):
    val = math.floor(A*i/B) - A*math.floor(i/B)
    #print("i", i, "val", val)
    ans = max(ans, val)

print(ans)


### FIXED CODE ###

import math
A, B, N = list(map(int, input().split()))
ans = 0
if B+1 < N:
    C = B+1
else:
    C = N
if B//A == 0:
    D = 1
elif B//A > 1:
  	D = B//A-1
else:
    D = B//A
for i in range(1, C+1, D):
    val = math.floor(A*i/B) - A*math.floor(i/B)
    #print("i", i, "val", val)
    ans = max(ans, val)

print(ans)
import math 
def monsters(li,n):
    t = temp
    for i in range(1,n-1):
        t = math.gcd(t,li[i+1])
    return t

n = int(input())
li_a = list(map(int,input().split()))
temp = li_a[0]
print(monsters(li_a,n))

### FIXED CODE ###

def gcd(a,b):
    while b:
        a,b = b,a % b
    return a
def monsters(li,n):
    t = temp
    for i in range(n-1):
        t = gcd(li[i+1],t)
    return t

n = int(input())
li_a = list(map(int,input().split()))
temp = li_a[0]
print(monsters(li_a,n))
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
A,B=map(int,(input().split()))    
print(lcm(A, B))

### FIXED CODE ###

import fractions

A,B=map(int,(input().split()))    
ABgcd=fractions.gcd(A,B)
answer=A*B//ABgcd
print(answer)
S = input()
T = input()

ans = 0
for s, t in zip(S, T):
    if s == t:
        ans += 1

print(ans)S = input()
T = input()

ans = 0
for s, t in zip(S, T):
    if s == t:
        ans += 1

print(ans)

### FIXED CODE ###

S = input()
T = input()

ans = 0
for s, t in zip(S, T):
    if s == t:
        ans += 1

print(ans)
s=input()
print(s[0] + int(len(s)-2) + s[-1])

### FIXED CODE ###

s=input()

print(s[0] + str(len(s)-2) + s[len(s)-1])
N, H, W = map(int, input().split())
A = []
B = []
counter = 0
for i in range(0,N):
    a,b  = map(int, input().split())
    if a>H and b>W:
        counter +=1
print(counter)


### FIXED CODE ###

a = list(input())
counter =0
for i in a:
    if i =='2':
        counter +=1
print(counter)
from sys import exit
n = int(input())
a = list(map(int, input().split()))
a.sort(Reverse = True)
ans = 1
for i in a:
  ans *= i
  if (ans > 1e18):
    print(-1)
    exit(0)
print(ans)


### FIXED CODE ###

from sys import exit
n = int(input())
a = list(map(int, input().split()))
ans = 1
a.sort()
for i in a:
  ans *= i
  if (ans > 1e18):
    print(-1)
    exit(0)
print(ans)
import math

a, b, x = [int(x) for x in input().split()]

bootle_volume = a * a * b
half_bootle_volume = 0.5 * bootle_volume

res = 0
if half_bootle_volume == x:
    res = math.degrees(math.atan(1))
elif half_bootle_volume > x:
    y = a - ((2 * x) / (a * b))
    degree = math.degrees(math.atan((a - y) / b))
    res = 90 - degree
elif half_bootle_volume < x:
    y = ((2 * x) / (a ** 2)) - b
    degree = math.degrees(math.atan(a / (b - y)))
    res = 90 - degree
elif x == a*a*b: print('0')

print(res)


### FIXED CODE ###

import math

a, b, x = [int(x) for x in input().split()]

bootle_volume = a * a * b
half_bootle_volume = 0.5 * bootle_volume

res = 0
if half_bootle_volume == x:
    res = math.degrees(math.atan(1))
elif half_bootle_volume > x:
    y = a - ((2 * x) / (a * b))
    degree = math.degrees(math.atan((a - y) / b))
    res = 90 - degree
elif half_bootle_volume < x:
    y = ((2 * x) / (a ** 2)) - b
    if y == b:
        res = 0
    else:
        degree = math.degrees(math.atan(a / (b - y)))
        res = 90 - degree

print(res)
a="".join(list(sorted(input())))
b="".join(list(sorted(input()))[::-1])
u=list(sorted(a,b))
if u[0]==a:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a="".join(list(sorted(input())))
b="".join(list(sorted(input()))[::-1])
u=list(sorted([a,b]))
if u[0]==u[1]:
  print("No")
elif u[0]==a:
  print("Yes")
else:
  print("No")
import heapq
job = list()
salary = list()
n,m = map(int,input().split())

for i in range(n):
    a,b = map(int,input().split())
    job.append(a,b)
    
job.sort(reverse = True)

for x in job:
    s,t = x
    heapq.heappush(salary,t)
    if s - m > 0:
        heapq.heappop(salary)
    else:
        m -= 1

print(sum(salary))


### FIXED CODE ###

import heapq
job = list()
salary = list()
n,m = map(int,input().split())

for i in range(n):
    a,b = map(int,input().split())
    job.append((a,b))

job.sort(reverse = True)

for x in job:
    s,t = x
    heapq.heappush(salary,t)
    if s - m > 0:
        heapq.heappop(salary)
    else:
        m -= 1

print(sum(salary))
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
cnt = 0
for i in range(n):
  if a[i] <= b[i]:
    cnt += a[i]
    b[i] -= a[i]
    if b[i] >= a[i+1]:
      cnt += a[i+1]
      a[i+1]=0
    else:
      cnt += b[i]
      a[i+1] -= b[i]
  else:
    cnt += b[i]
print(cnt)

### FIXED CODE ###

import math
X=int(input())
while True:
    for i in range(2,int(math.sqrt(X))+1):
      if X%i==0:
        X+=1
        break
    else:
      print(X)
      break
a,b = map(int,input().split())
"""
s = input()
s = s.split(" ")
a = int(s[0])
b = int(s[1])
"""

count = 0
while b > 0:
  count += 1
  b -= (count*(a-1)+1):
    
print(count)


### FIXED CODE ###

s = list(map(int,input().split()))
a = int(s[0])
b = int(s[1])

count = 0
while (b - (count*(a-1)+1)) > 0:
  count += 1
  
print(count)
N, X = map(int, input().split())
L = map(int, input().split())

x = 0
cnt = 0
for l in L:
    x += l
    if x > X:
        break
    else:
        cnt += 1

print(cnt+1)

### FIXED CODE ###

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

if x < a:
    print(0)
else:
    print(10)
l = map(int ,raw_input().split() )
for i in range(len(l)):
  a='Odd'
  if l[i]% 2 = 0:
    a = 'Even'
print(a)

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
n, m = map(int, input().split())
People = {x+1:[] for x in range(10**6+1)}

for _ in range(m):
    l, r, d = map(int, input().split())
    People[l].append([r, d])
    People[r].append([l, -d])

Place = ['x' for _ in range(10**6+1)]

min_num = 10**7
for i in range(1,n+1):
    if len(People[i]) == 0:
        pass
    else:
        min_num = min(min_num, i)

if m != 0:
    Place[min_num] = 0
    ans = 'Yes'
    for i in range(1,10**6+1):
        Related = People[i]
        for related in Related:
            person = related[0]
            place = related[1]
            if Place[person] == 'x':
                Place[person] = Place[i] + place
            elif Place[person] != Place[i] + place:
                ans = 'No'
                break
else:
    ans = 'Yes'

print(ans)

### FIXED CODE ###

from collections import deque

n, m = map(int, input().split())
People = {x+1:[] for x in range(10**6+1)}

for _ in range(m):
    l, r, d = map(int, input().split())
    People[l].append([r, d])
    People[r].append([l, -d])

INF = 10**10
Visited = [INF for i in range(10**6+1)]

def bfs(v):
    dq = deque()
    dq.append(v)
    Visited[v] = 0
    check = True
    while dq:
        now = dq.popleft()
        Related = People[now]
        for related in Related:
            if Visited[related[0]] == INF:
                dq.append(related[0])
                Visited[related[0]] = Visited[now] + related[1]
            elif Visited[related[0]] != Visited[now] + related[1]:
                check = False
    return check

ans = 'Yes'
for i in range(1,10**6+1):
    if Visited[i] == INF:
        if bfs(i) == False:
            ans = 'No'

print(ans)
N, K = map(int, input().split())
A = []
# N, K = 10, 3
# A = [1,5,4,3,8,6,9,7,2,4]
for _ in range(N):
  A.append(int(input()))
dp = [0]*N
nextdp = [1]*(300000)
tmp = 0
while tmp < N:
  dp[tmp] = nextdp[A[tmp]]
  for n in range(0,2*K+1):
    n -= K
    if 300000 > A[tmp]+n >= 0:
      nextdp[A[tmp]+n] = max(nextdp[A[tmp]+n], dp[tmp]+1)
  tmp += 1
print(dp[-1])


### FIXED CODE ###

K = int(input())
print("ACL"*K)
n=int(input())
A=sorted(map(int,input().split()))
L=[A[0]]
if n==0:
    print(0)
else:
    c=0
    if A[0]!=A[1]:
        c=1
    for i in range(n-1):
        flag=0
        for l in L:
            if A[i+1]%l==0:
                flag=1
                break

        if flag==0:
            L.append(A[i+1])
            c+=1
    print(c)

### FIXED CODE ###

from collections import defaultdict
n=int(input())
A=sorted((map(int,input().split())))
maxA=max(A)
L=[0]*(maxA+1)
AD=defaultdict(int)
for a in A:
	L[a]=1
	AD[a]+=1
for a in A:
	if AD[a]>=2:
		L[a]=0
	for i in range(2*a,maxA+1,a):
		L[i]=0
print(sum(L))
A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
ans = C-(A-B)
if ans > 0:
  print(ans)
else:
  print(0)

### FIXED CODE ###

A, B, C = map(int, input().split())
ans = C-(A-B)
if ans > 0:
  print(ans)
else:
  print(0)
n,k = map(int,input().split())
u = n
d = [0 for i in range(k)]
a = [0 for i in range(n)]
for i in range(k):
    d[i] = int(input())
    a[i] = list(map(int,input().split()))
pe = [ i+1 for i in range(n)]
for i in range(k):
    for j in range(len(a[i])):
        for v in range(1,n+1):
            if a[i][j] == v:
            	if pe.count(v) > 0:
                	pe.remove(v)               
print(len(pe))

### FIXED CODE ###

n,k = map(int,input().split())
o = 0
g = []
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in range(d):
        g.append(a[j])
g.sort()
for i in range(len(g)-1):
    if g[i] == g[i+1]:
        o += 1
print(n-len(g)+o)
a,b = map(int,input())
if a<b:
    print(a-1)
else:
    print(a)



### FIXED CODE ###

a,b = map(int,input().split())
if a>b:
    print(a-1)
else:
    print(a)
if __name__ == '__main__':
    n = int(input())
    al = [int(a) for a in input().split()]
    bl = [int(b) for b in input().split()]

    score = 0
    while len(bl) > 0:
        a = al.pop()
        b = bl.pop()

        if a >= b:
            score += b
        else:
            score += a
            b -= a
            a2 = al.pop()

            if a2 > b:
                score += b
                a2 -= b
                al.append(a2)
            else:
                score += a2
    print(score)




### FIXED CODE ###

if __name__ == '__main__':
    n = int(input())
    al = [int(a) for a in input().split()]
    bl = [int(b) for b in input().split()]

    score = 0
    remaining = 0
    for i in range(n):
        a = al[i]
        b = bl[i]
        if a >= b:
            score += b
        else:
            score += a
            b -= a
            a2 = al[i + 1]
            if a2 > b:
                score += b
                a2 -= b
                al[i + 1] = a2
            else:
                score += a2
                al[i + 1] = 0
    print(score)
k, s = map(int, input().split())
res = 0

for x in range(k+1):
  if x <= s:
  	for y in range(k+1):
      if (x + y) <= s:
    	for z in range(k+1):
      		if (x + y + z) == s:
        		res += 1
        
print(res)

### FIXED CODE ###

k, s = map(int, input().split())
res = 0

for x in range(k+1):
  for y in range(k+1):
    z = s - (x + y)
    if z >= 0 and z <= k:
      res += 1
        
print(res)
st=[]
while True:
  n=input()
  
  if n=="":
    break
    
  st += n.lower()
  char = "abcdefghijklmnopqrstuvwxyz"

  for i in range(len(char)):
    print(char[i],":",st.count(char[i]))


### FIXED CODE ###

st=[]

while True:
  try:
    n=input()
    if n=="":
      break
    st += n.lower()
  except:
    break
   
char = "abcdefghijklmnopqrstuvwxyz"
for i in range(len(char)):
  print(char[i],":",st.count(char[i]))
N,X,M = map(int, input().split())


A = [-1]*M
A[0] = X
i = 0
tmpans = 0
flag = False
check = [-1]*(M+1)
slice = -1
while i< N-1:
    newa = A[i]**2%M
    i+= 1
    if check[newa] != -1:
        flag = True
        slice = check[newa]
        break
    A[i] = newa
    check[newa] = i

if not flag:
    print(sum(A[:i+1]))

else:
    print(sum(A[:slice])+ sum(A[slice:i])*((N-slice)//(i-slice))+sum(A[slice:(N-slice)%(i-slice)]))


### FIXED CODE ###

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


A = [-1]*(M+100)
A[0] = X
i = 0
tmpans = 0
flag = False
check = [-1]*(M+1)
slice = -1
while i< N-1:
    newa = A[i]**2%M
    i+= 1
    if check[newa] != -1:
        flag = True
        slice = check[newa]
        break
    A[i] = newa
    check[newa] = i

if not flag:
    print(sum(A[:i+1]))

else:
    print(sum(A[:slice])+ sum(A[slice:i])*((N-slice)//(i-slice))+sum(A[slice:slice + (N-slice)%(i-slice)]))
a, b=map(int, input().split())
try:
	c = a // (b // 2)
	c = c //2 + c% 2
except Exception:
  c = 0
try:
    d = a // b
except Exception:
  d = 0
    print(c**3 + d **3)

### FIXED CODE ###

a, b=map(int, input().split())
try:
    c = a // (b // 2)
    c = c //2 + c%2
except Exception as  e:
    c = 0
if b % 2 == 1:
    c = 0
try:
    d = a // b
except Exception as e:
    d = 0
print(c**3 + d**3)
import numpy as np

n = int(input())
a = list(map(int, input().split()))
lcm = 1

lc = mp.lcm.reduce(a)

res = 0
for i in range(n):
    res = res + lc // a[i]
    res = res % 1000000007

print(res)



### FIXED CODE ###

import fractions
def LCM(a, b):
    return(a // fractions.gcd(a, b) * b)

n = int(input())
a = list(map(int, input().split()))
lc = 1;

for i in range(n):
    lc = LCM(lc, a[i])

res = 0;
for i in range(n):
    res = res + (lc // a[i])

print(res % 1000000007)
h, n = map(int, input().split())
a = []
a.append(map(int,input().split()))
sum = 0

for i in a:
  sum += i
  
if sum >= h:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

h, n = map(int, input().split())
a = list(map(int,input().split()))
sum = 0

for i in a:
  sum += i
  
if sum >= h:
  print("Yes")
else:
  print("No")
yy,mm,dd =map(int,input().split('/'))

if yy>2019:
  print('TBD')
else:
  if mm>4:
    print('TBD')
  else:
    if mm==1 or mm==3:
      if dd>31:
        print('TBD')
      else:
        print('Heisei')
    if mm==2:
      if d>29:
        print('TBD')
      else:
        print('Heisei')
    if mm==4:
      if d>30:
        print('TBD')
      else:
        print('Heisei')




### FIXED CODE ###

yy,mm,dd =map(int,input().split('/'))

if yy>2019:
  print('TBD')
else:
  if mm>4:
    print('TBD')
  else:
    if mm==1 or mm==3:
      if dd>31:
        print('TBD')
      else:
        print('Heisei')
    if mm==2:
      if dd>29:
        print('TBD')
      else:
        print('Heisei')
    if mm==4:
      if dd>30:
        print('TBD')
      else:
        print('Heisei')
import sys
import os
f = open("C:/Users/kazuki/Documents/python/import.txt","r")
sys.stdin = f
# -*- coding: utf-8 -*-
import itertools
import math
from collections import deque
from collections import defaultdict
from itertools import permutations
import heapq
import bisect
from scipy.sparse.csgraph import floyd_warshall as wf
from collections import Counter
from itertools import*
from bisect import bisect_left,bisect_right
from collections import Counter
inf = 10**10
input = sys.stdin.readline

n,m,q = map(int,input().split())
c=[[0 for i in range(n+1)] for j in range(n+1)]
x=[[0 for i in range(n+1)] for j in range(n+1)]
for i in range(m):
    l,r = map(int,input().split())
    x[l][r] += 1
for i in range(1,n+1):
    for j in range(1,n+1):
        c[i][j] = c[i][j-1] + x[i][j]
for i in range(q):
    p,q = map(int,input().split())
    sum = 0
    for j in range(p,q+1):
         sum+= c[j][q] - c[j][p-1]
    print(sum)

### FIXED CODE ###

import sys
input = sys.stdin.readline

n,m,q = map(int,input().split())
c=[[0 for i in range(n+1)] for j in range(n+1)]
x=[[0 for i in range(n+1)] for j in range(n+1)]
for i in range(m):
    l,r = map(int,input().split())
    x[l][r] += 1
for i in range(1,n+1):
    for j in range(1,n+1):
        c[i][j] = c[i][j-1] + x[i][j]
for i in range(q):
    p,q = map(int,input().split())
    sum = 0
    for j in range(p,q+1):
         sum+= c[j][q] - c[j][p-1]
    print(sum)
a,b,c = input().split()

S = a+b+c

j=0
if S[0] ==o:
  j += 100
if S[1] ==o:
  j += 100
if S[2] ==o:
  j += 100
  
print(700 + int(j))

### FIXED CODE ###

print( 700 + 100*input().count("o"))
def main():
    N = int(input())
    lst = [input().split()for i in range(N)]
    Y = 0

    for i in range(0, N):
        if lst[i][1] == "JPY":
            Y += float(lst[i][0])
        else:
            Y += float(lst[i][0])*380000.0
    print(Y)


if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    import datetime
    s = str(input())
    S = datetime.datetime.strptime(s, "%Y/%m/%d")
    if(S <= datetime.datetime(2019, 4, 30)):
        print("Heisei")
    else:
        print("TBD")


if __name__ == "__main__":
    main()