Harryxun/stf_run huggingface dataset:
'''input
6
1 2
1 3
1 4
1 5
1 6
'''
# A coding delight
from sys import stdin, stdout
import gc
gc.disable()
input = stdin.readline
from collections import defaultdict
import resource
import sys

resource.setrlimit(resource.RLIMIT_STACK, [0x10000000, resource.RLIM_INFINITY])
sys.setrecursionlimit(0x100000)

def get_source():
	for i in graph:
		return i


def make(first, second):
	return str(first) + ' ' + str(second)


def dfs(node, visited, color, medges, mx_c):
	visited[node] = True
	c = 1
	for i in graph[node]:
		if i not in visited:
			if color[node] == c:
				c += 1
			color[i] = c
			medges[make(node, i)] = c
			medges[make(i, node)] = c
			mx_c[0] = max(mx_c[0], c)
			c += 1
			dfs(i, visited, color, medges, mx_c)


# main starts
graph = defaultdict(list)
n = int(input().strip())
edges = []
for _ in range(n - 1):
	u, v = list(map(int, input().split()))
	graph[u].append(v)
	graph[v].append(u)
	edges.append([u, v])

s = get_source()
color = dict()
visited = dict()
color[s] = 0
medges = dict()
mx_c =[0]
dfs(s, visited, color, medges, mx_c)

print(mx_c[0])
for i, j in edges:
	print(medges[make(i, j)])


### FIXED CODE ###

'''input
6
1 2
1 3
1 4
1 5
1 6
'''
# A coding delight
from sys import stdin, stdout
import gc
gc.disable()
input = stdin.readline
from collections import defaultdict
import sys, threading


def get_source(graph):
	for i in graph:
		return i


def make(first, second):
	return str(first) + ' ' + str(second)


def dfs(graph, node, visited, color, medges, mx_c):
	visited[node] = True
	c = 1
	for i in graph[node]:
		if i not in visited:
			if color[node] == c:
				c += 1
			color[i] = c
			medges[make(node, i)] = c
			medges[make(i, node)] = c
			mx_c[0] = max(mx_c[0], c)
			c += 1
			dfs(graph, i, visited, color, medges, mx_c)


# main starts
def main():
	graph = defaultdict(list)
	n = int(input().strip())
	edges = []
	for _ in range(n - 1):
		u, v = list(map(int, input().split()))
		graph[u].append(v)
		graph[v].append(u)
		edges.append([u, v])

	s = get_source(graph)
	color = dict()
	visited = dict()
	color[s] = 0
	medges = dict()
	mx_c =[0]
	dfs(graph, s, visited, color, medges, mx_c)

	print(mx_c[0])
	for i, j in edges:
		print(medges[make(i, j)])


if __name__ == '__main__':
	sys.setrecursionlimit(100005)
	threading.stack_size(1 << 27)
	thread = threading.Thread(target = main)
	thread.start()
A,B=map(int,input().split())
import math

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

print(lcm(A,B))

### FIXED CODE ###

import fractions
A,B=map(int,input().split())

print((A * B) // fractions.gcd(A, B))
from collections import deque

n = int(input())
a = list((map(int, input().split())))
s = deque([])

for i in range(n):
    if i%2==1:
        s.insert(0, a[i])
    else:
        s.append(a[i])

print(*s)

### FIXED CODE ###

from collections import deque

n = int(input())
a = list(map(int, input().split()))
s = deque([])

for i in range(n):
    if i%2==1:
        s.appendleft(a[i])
    else:
        s.append(a[i])
if n%2 == 1:
    s.reverse()
print(*s)
from collections import deque
import math
ans = 0
n = int(input())
h = math.ceil(n/2)
board = [[0]*h for _ in range(h)]
for i in range(1,h + 1):
  for j in range(1,h + 1):
    board[i - 1][j - 1] = i * j
sx = 1
sy = 1
dist = [[-1]*h for _ in range(h)]
que = deque([(sy - 1,sx - 1)])
dist[sy - 1][sx - 1] = 0
while que:
  y,x = que.popleft()
  if board[y][x] == n:
    ans = dist[y][x]
    break
  for y1,x1 in [(y + 1,x),(y, x + 1)]:
    if y1 < 0 or x1 < 0 or y1 >= h or x1 >= h:
      continue
    if dist[y1][x1] != -1:
      continue
    dist[y1][x1] = dist[y][x] + 1
    que.append((y1,x1))
print(ans)

### FIXED CODE ###

import sys
from collections import deque
import math


# ans = 0
n = int(input())
#h = math.ceil(n/2)
dists = []
h = math.ceil(math.sqrt(n))
# i <= jとする
for i in range(1,h + 1):
    if n % i != 0:
      continue
    j = int(n / i)
    dists.append(i + j - 2)
print(min(dists))


# h = math.ceil(n/2)
# board1 = [[0]*h/2 for _ in range(h/2)]
# board2 = [[0]*h/2 for _ in range(h/2)]
# for i in range(1,h/2 + 1):
#   for j in range(1,h/2 + 1):
#     board1[i - 1][j - 1] = i * j
# for i in range(h/2 + 1,h + 1):
#   for j in range(h/2 + 1,h + 1):
#     board2[i - (h/2 + 1)][j - (h/2 + 1)] = i * j
# sx = 1
# sy = 1
# gx = 0
# gy = 0
# dist1 = [[-1]*h/2 for _ in range(h/2)]
# dist2 = [[-1]*h/2 for _ in range(h/2)]
# que = deque([(sy - 1,sx - 1)])
# dist1[sy - 1][sx - 1] = 0
# while que:
#   y,x = que.popleft()
#   if board1[y][x] == n:
#     ans = dist1[y][x]
#     break
#   for y1,x1 in [(y + 1,x),(y, x + 1)]:
#     if y1 < 0 or x1 < 0 or x1 >= h/2:
#       continue
#     if y1 >= h/2:
#       sy = y1
#       sx = x1
#       gy = y
#       gx = x
#       break
#     if dist1[y1][x1] != -1:
#       continue
#     if dist1[y1][x1] == -1:
#       dist1[y1][x1] = dist1[y][x] + 1
#       que.append((y1,x1))
# que = deque([sy,sx])
# dist2[sy][sx] = 0
# while que:
#   y,x = que.popleft()
#   if board2[y][x] == n:
#     ans = dist1[gy][gx] + dist2[y][x]
#     break
#   for y1,x1 in [(y + 1,x),(y, x + 1)]:
#     if y1 < 0 or x1 < 0 or x1 >= h/2:
#       continue
#     if y1 >= h/2:
#       sy = y1
#       sx = x1
#       break
#     if dist2[y1][x1] != -1:
#       continue
#     if dist2[y1][x1] == -1:
#       dist2[y1][x1] = dist2[y][x] + 1
#       que.append((y1,x1))
# print(ans)
As = []

for i in range(N):
    if i == N-1:
        As.append(Bs[i-1])
    elif i == 0:
        As.append(Bs[0])
    else:
        As.append(min([Bs[i-1],Bs[i]]))

print(sum(As))

### FIXED CODE ###

N = int(input())
Bs = list(map(int, input().split()))
As = []

for i in range(N):
    if i == N-1:
        As.append(Bs[i-1])
    elif i == 0:
        As.append(Bs[0])
    else:
        As.append(min([Bs[i-1],Bs[i]]))

print(sum(As))
import sys
# -*- coding: utf-8 -*-
# 整数の入力
n=int(input())
a=list(map(int, input().split()))
b=a[:]
c=a[:]
# 無変更チェック
if a[0]!=0:
  S=int(a[0])
  for i in range(1,n):
    if S<0 and S+a[i]<=0:
      break
    elif S>0 and S+a[i]>=0:
      break
    S+=a[i]
    if i==n-1:
      print(0)
      sys.exit()
# a[0]を1に変えた場合の計算
counter_2=abs(b[0]-1)
b[0]=1
S=b[0]
for i in range(1,n):
  if S<0 and S+b[i]<=0:
    counter_2+=-S-b[i]+1
    b[i]=-S+1
  elif S>0 and S+b[i]>=0:
    counter_2+=S+b[i]+1
    b[i]=-S-1
  S+=b[i]
# a[0]を-1に変えた場合の計算
counter_3=abs(c[0]+1)
c[0]=-1
S=c[0]
for i in range(1,n):
  if S<0 and S+c[i]<=0:
    counter_3+=-S-c[i]+1
    c[i]=-S+1
  elif S>0 and S+c[i]>=0:
    counter_3+=S+c[i]+1
    c[i]=-S-1
  S+=c[i]
print(min(counter_1,counter_2,counter_3))

### FIXED CODE ###

# -*- coding: utf-8 -*-
# 整数の入力
n=int(input())
a=input().split()
b=a[:]
c=a[:]
# a[0]の符号をそのままにした場合の計算
counter_1=0
S=int(a[0])
for i in range(1,n):
  if S<0 and S+int(a[i])<=0:
    counter_1+=-S-int(a[i])+1
    a[i]=-S+1
  elif S>0 and S+int(a[i])>=0:
    counter_1+=S+int(a[i])+1
    a[i]=-S-1
  S+=int(a[i])
# a[0]を1に変えた場合の計算
counter_2=abs(int(b[0])-1)
b[0]=1
S=b[0]
for i in range(1,n):
  if S<0 and S+int(b[i])<=0:
    counter_2+=-S-int(b[i])+1
    b[i]=-S+1
  elif S>0 and S+int(b[i])>=0:
    counter_2+=S+int(b[i])+1
    b[i]=-S-1
  S+=int(b[i])
# a[0]を-1に変えた場合の計算
counter_3=abs(int(c[0])+1)
c[0]=-1
S=c[0]
for i in range(1,n):
  if S<0 and S+int(c[i])<=0:
    counter_3+=-S-int(c[i])+1
    c[i]=-S+1
  elif S>0 and S+int(c[i])>=0:
    counter_3+=S+int(c[i])+1
    c[i]=-S-1
  S+=int(c[i])
print(min(counter_1,counter_2,counter_3))
n, m = map(int, input().split())
if m == 1:
  print(0)
else:
  x = list(map(int, input().split()))
  x.sort()
  d = [0]*(m-1)
  for i in range(m-1):
    d[i] = x[i+1] - x[i]
  d.sort(reverse = True)
  sum = sum(d)
  for i in range(n-1):
    sum -= d[i]
  print(sum)

### FIXED CODE ###

n, m = map(int, input().split())
if m == 1 or n >= m:
  print(0)
else:
  x = list(map(int, input().split()))
  x.sort()
  d = [0]*(m-1)
  for i in range(m-1):
    d[i] = x[i+1] - x[i]
  d.sort(reverse = True)
  sum = sum(d)
  for i in range(n-1):
    sum -= d[i]
  print(sum)
n = int(input())

if n == 1 or n == 2:
    print(n)
else:
    a = []
    m = 0
    for i in range(1, n):
        if m > n: break
        a.append(i)
        m += i


    b = []
    for i in range(len(a) ** 2):
        g = []
        for j in range(len(a)):
            if ((i >> j) & 1):
                g.append(a[j])
        if sum(g) == n:
            b.append([g[-1], g])

    b.sort()
    for item in b[0][1]:
        print(item)            



### FIXED CODE ###

n = int(input())

a = []
m = 0
for i in range(n):
    if m >= n: break
    a.append(i+1)
    m += i+1
    
if m == n:
    print(*a)
else:
    a.remove(m-n)
    print(*a)
li = list(map(int,input().split()))
ans=li[2]-(li[0]-li[1])
if ans>=0:
  print(ans)
elif:
  print("0")

### FIXED CODE ###

li = list(map(int,input().split()))
ans=li[2]-(li[0]-li[1])
if ans>=0:
    print(ans)
else:
    print("0")
s=input().strip()
s=s.replace("eraser","")
s=s.replace("erase","")
s=s.repalce("dreamer","")
s=s.reaplce("dream","")
print("YES" if s else "NO")

### FIXED CODE ###

s=input().strip()
s=s.replace("eraser","")
s=s.replace("erase","")
s=s.replace("dreamer","")
s=s.replace("dream","")
print("YES" if not s else "NO")
n, m, k = map(int, input().split())
a = [a for a in input().split()]
b = [b for b in input().split()]

time = 0
ans = 0

while time <= k:
    if a[0] < b[0]:
        time += a.pop(0)
        a.append(200001)
    elif a[0] > b[0]:
        time += b.pop(0)
        b.append(200001)
    else:
        if a[1] < b[1]:
            time += a.pop(0)
            a.append(200001)
        else:
            time += b.pop(0)
            b.append(200001)
    
    if time <= k:
        ans += 1
    else:
        break

print(ans)

### FIXED CODE ###

n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A_cumsum, B_cumsum = [0], [0]

for i in range(n):
    A_cumsum.append(A_cumsum[i] + A[i])
    
for j in range(m):
    B_cumsum.append(B_cumsum[j] + B[j])
    
ans, j = 0, m

for i in range(n + 1): # 0を最初に代入した分
    if A_cumsum[i] > k:
        break
    while A_cumsum[i] + B_cumsum[j] > k:
        j -= 1
    ans = max(ans, i + j)

print(ans)
N, Q = map(int,input().split())
S = input()
#'AC'が見つかったらCのほうに+1
count = [0]*(N+1)
for i in range(N):
    if S[i] == "A":
        if S[i+1] == "C":
            count[i+1] += count[i] + 1
        else:
            count[i+1] = count[i]
    else:
        count[i+1] = count[i]
    
#print(count)

for _ in range(Q):
    l, r = map(int,input().split())
    print(count[r-1]-count[l-1])

### FIXED CODE ###

N, Q = map(int,input().split())
S = input()+"d"
#'AC'が見つかったらCのほうに+1
count = [0]*(N+1)
for i in range(N):
    if S[i] == "A":
        if S[i+1] == "C":
            count[i+1] += count[i] + 1
        else:
            count[i+1] = count[i]
    else:
        count[i+1] = count[i]
    
#print(count)

for _ in range(Q):
    l, r = map(int,input().split())
    print(count[r-1]-count[l-1])
k = ['AC','WA','TLE','RE']
n=int(input())
ans = {}
for _ in range(n):
  r = input()
  ans[r]=ans.get(r,0)+1
for r in k:
  print(r,'x',ans[r].get(r,0))


### FIXED CODE ###

k = ['AC','WA','TLE','RE']
n=int(input())
ans = {}
for _ in range(n):
  r = input()
  ans[r]=ans.get(r,0)+1
for r in k:
  print(r,'x',ans.get(r,0))
import numpy as np
from math import gcd
from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
N = int(input())
a = list(map(int,input().split()))
a = np.array(a)
a = np.sort(a)[::-1]
MAX = lcm_list(a)
#print (MAX)
Flag = True
q = 0
add = a[0]
sum = 0
max = np.sum(a)-len(a)
#print (max)
n = a[0]*q+a[0]-1
while True:
    st = np.sum(n%a)
    if st == max:
        sum = st
        break
    if st > MAX:
        break
    ind = np.where(a - n%a == 1)[0]
    #print (ind)
    c = a[ind]
    n += np.prod(c)
    #print (sum)
print (sum)


### FIXED CODE ###

import numpy as np
N = int(input())
a = list(map(int,input().split()))
print (np.sum(a)-len(a))
item=list(map(int,input().split())).sorted()
print(item)

### FIXED CODE ###

item=list(map(int,input().split()))
item.sort()
times=0
while sum(item)/3!=item[0]:
  if item[1]==item[2]:
    item[0]+=2
    times+=1
    item.sort()
  else:
    item[0]+=1
    item[1]+=1
    times+=1
    item.sort()
print(times)
class RollingHash:
    def __init__(self,S,base,M):
        self.N=len(S)
        self.M=M
        self.H=[0]*(self.N+1)
        self.B=[0]*(self.N+1)
        self.B[0]=1
        for i in range(self.N):
            self.B[i+1]=self.B[i]*base%M
            self.H[i+1]=(self.H[i]*base+(ord(S[i])-96))%M
    def get(self,l,r):
        return (self.H[r]-self.H[l]*self.B[r-l]+self.M)%self.M
    def getall(self,L):
        arr=[]
        for i in range(L,self.N+1):
            arr.append(self.get(i-L,i))
        return arr

def Hash(S,base,M):
    H=0
    for c in S:
        H=(H*base+ord(c)-96)%M
    return H
    
def isbad(L):
    arr=RH.getall(L)
    s=set()
    for i in range(L,N-L+1):
        s.add(arr[i-L])
        if arr[i] in s:
            return False
    return True
    
import random
N=int(input())
S=input()
MOD=2**61-1
base=random.randrange(100,MOD)
RH=RollingHash(S,base,MOD)
l,r=-1,N+1
while(r-l>1):
    mid=(l+r)//2
    if isbad(mid):
        r=mid
    else:
        l=mid
print(l)

### FIXED CODE ###

S=input()
print('Sunny' if S=='Rainy' else 'Cloudy' if S=='Sunny' else 'Rainy')
n = int(input())
table = []
for i in range(n):
  s = input()
  if s not in table
  table.append(s)
print(len(table))
  

### FIXED CODE ###

table = []
n = int(input())
for i in range (n):
    s = input()
    table.append(s)
print(len(list(set(table))))
import collections
n = int(input())
v = list(map(int, input().split()))

count = 0
v1 = []
v2 = []
while count < n:
  v1.append(v[count])
  v2.append(v[count + 1])
  count += 2

c1 = collections.Counter(v1)
c2 = collections.Counter(v2)

num1, count1 = c1.most_common()[0]
num2, count2 = c2.most_common()[0]

if num1 != num2:
  min_count = (n // 2 - count1) + (n // 2 - count2)
elif count1 == count2 and count1 == n // 2:
  min_count = (n // 2)
else:
  if count1 == count2:
    for i in range(min(len(c1.most_common()), c2.most_common())):
        a = i + 1
        if c1.most_common()[a][a] == c2.most_common()[a][a]:
            continue
        if c1.most_common()[a][a] > c2.most_common()[a][a]:
            num2, count2 = c2.most_common()[a]
            break
        else:
            num1, count1 = c1.most_common()[a]
            break
    min_count = (n // 2 - count1) + (n // 2 - count2)
  else:
    if len(c1.most_common()) > 1 and len(c2.most_common())
      num3, count3 = c1.most_common()[1]
      num4, count4 = c2.most_common()[1]
      a = (n // 2 - count1) + (n // 2 -count4)
      b = (n // 2 - count2) + (n // 2 -count3)
      min_count = min(a,b)
    else:
      if count1 > count2:
        num2, count2 = c2.most_common()[1]
        min_count = (n // 2 - count1) + (n // 2 - count2)
      else:
        num1, count1 = c1.most_common()[1]
        min_count = (n // 2 - count2) + (n // 2 - count1)
print(min_count)

### FIXED CODE ###

import collections
n = int(input())
v = list(map(int, input().split()))

count = 0
v1 = []
v2 = []
while count < n:
  v1.append(v[count])
  v2.append(v[count + 1])
  count += 2

c1 = collections.Counter(v1)
c2 = collections.Counter(v2)

num1, count1 = c1.most_common()[0]
num2, count2 = c2.most_common()[0]

if num1 != num2:
  min_count = (n // 2 - count1) + (n // 2 - count2)
elif count1 == count2 and count1 == n // 2:
  min_count = (n // 2)
else:
  if len(c1.most_common()) > 1 and len(c2.most_common()):
    num3, count3 = c1.most_common()[1]
    num4, count4 = c2.most_common()[1]
    a = (n // 2 - count1) + (n // 2 -count4)
    b = (n // 2 - count2) + (n // 2 -count3)
    min_count = min(a,b)
  else:
    if count1 > count2:
      num2, count2 = c2.most_common()[1]
      min_count = (n // 2 - count1) + (n // 2 - count2)
    else:
      num1, count1 = c1.most_common()[1]
      min_count = (n // 2 - count2) + (n // 2 - count1)
print(min_count)
N = int(input())
R = int(input())

if 0<=R<=4111 and 1<=N<=100:
    if N>=10:
        IR = R
        print(IR,end='\n')
    elif N<10:
        IR = R + 100*(10-N)
        print(IR,end='\n')

### FIXED CODE ###

InputValue = input().split(' ')

N = int(InputValue[0])
R = int(InputValue[1])

if 0<=R<=4111 and 1<=N<=100:
    if N>=10:
        IR = R
        print(IR,end='\n')
    elif N<10:
        IR = R + 100*(10-N)
        print(IR,end='\n')
x = 2 * R * 3

### FIXED CODE ###

import math

R = int(input())

print(R * 2 * math.pi)
N = input()
D = [i for i in input()]
M = input()
T = [i if i in D else "<muri>" for i in input()]

if "<muri>" in T:
    print("NO")
    quit()
for t in T:
    if d in D:
        D.remove(t)
    else:
        print("NO")
else:
    print("NO")

### FIXED CODE ###

from collections import Counter
N = input()
D = Counter([i for i in input().split()])
M = input()
T = Counter([i for i in input().split()])
for key, value in T.items():
    try:
        if D[key] < value:
            print("NO")
            break
    except:
        print("NO")
        break
else:
    print("YES")
print(eval(int(input()).replace(' ','/')))

### FIXED CODE ###

t,x=map(int,input().split())
print(t/x)
n = input()
l = len(n)-1

for i in range(2**l):
    op = ["-"]*l
    for j in range(l):
        if (i>>j) &1:
            op[i-j-1]="+"
    formula = ""
    for op_num,op_l in zip(n,op):
        formula += op_num+op_l
        if eval(formula)==7:
            print(formula+"=7")
            break

### FIXED CODE ###

def dfs(i, Str, res):
    if i==3:
        if res==7:
            print(Str+"=7")
            exit()
        return
    
    dfs(i+1,Str+"+"+s[i+1],res+int(s[i+1]))
    dfs(i+1,Str+"-"+s[i+1],res-int(s[i+1]))

s=input()
dfs(0,s[0],int(s[0]))
N, M = [int(i) for i in input().split()]
A = sorted([s for s in input().split()], reverse=True)
numDict = {"1":2, "2":5, "3":5, "4":4, "5":5, "6":6, "7":3, "8":7, "9":6}
dp = ["" for _ in range(N + 1)]

for i in range(N + 1):
    for strNum in A:
        if i - numDict[strNum] == 0 and dp[i] == "":
            dp[i] = strNum

        preStrNum = dp[i - numDict[strNum]]
        if preStrNum != "":
            if len(preStrNum) + 1 > len(dp[i]) or \
            len(preStrNum) + 1 == len(dp[i]) and preStrNum[0] > strNum:
                dp[i] = "{0}{1}".format(preStrNum, strNum)

print(dp[N])


### FIXED CODE ###

N, M = [int(i) for i in input().split()]
A = sorted([s for s in input().split()], reverse=True)
numDict = {"1":2, "2":5, "3":5, "4":4, "5":5, "6":6, "7":3, "8":7, "9":6}
dp = ["" for _ in range(N + 1)]

for i in range(N + 1):
    for strNum in A:
        if i - numDict[strNum] < 0:
            continue
        if i - numDict[strNum] == 0 and dp[i] == "":
            dp[i] = strNum
        preStrNum = dp[i - numDict[strNum]]
        if preStrNum != "":
            if len(preStrNum) + 1 > len(dp[i]):
                dp[i] = preStrNum + strNum

print("".join(sorted(dp[N], reverse=True)))
from fraction import gcd
n=int(input())
t=[]
for _ in range(n):
    a=int(input())
    t.append(a)
def lcm_base(x,y):
    return (x*y // gcd(x,y))
def lcm_list(l):
    return reduce(lcm_base,l,1)


### FIXED CODE ###

from fractions import gcd
from functools import reduce
n=int(input())
t=[]
for _ in range(n):
    a=int(input())
    t.append(a)
def lcm_base(x,y):
    return (x*y // gcd(x,y))
def lcm_list(l):
    return reduce(lcm_base,l,1)
print(lcm_list(t))
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
st = s + t
c = []
maxidx = 0
maxcount = -float('inf')

for i in set(st):
    count = s.count(i) - t.count(i)
    c.append((i, count))
    if count > maxcount:
        maxcount = count
        maxind = st.index(i)
        
if not(len(c) == 0) and (c[maxind][1] > 0):
    print(c[maxind][1])
else:
    print(0)

### FIXED CODE ###

n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))
S = int(input())
W = int(input())
if W < S:
  print("safe")
else:
  print("unsafe")

### FIXED CODE ###

S, W = input().split()
if int(S) > int(W):
  print("safe")
else:
  print("unsafe")
n = int(input())
ans = 0
dict = {}
for _ in range(n):
    s = sorted(list(input()))
    if dict[s] == NULL:
        dict[s] = 0
    ans += dict[s]
    dict[s] += 1
print(ans)

### FIXED CODE ###

n = int(input())
ans = 0
dict = {}
for _ in range(n):
    s = str(''.join(sorted(list(input()))))
    try:
        ans += dict[s]
        dict[s] += 1
    except:
        dict[s] = 1
print(ans)
L, R = map(int, input().split())

Lmod = L%2019
Rmod = R%2019

i = Lmod
j = i + 1

for k in range(L, R+1):
  if (k%2019) == 0:
    print(0)
    break
  elif k < R:
	continue
  else:
	print((i*j)%2019)

### FIXED CODE ###

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

print(min(A*N, B))
import sys
import heapq
import copy


def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)


def _heappop_max(heap):
    """Maxheap version of a heappop."""
    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt


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

sum_h1 = [0] * (N+1)
sum_h2 = [0] * (N+1)

'''
N=2
0 1 2 3 4 5 6
3 1 4 1 5 9
'''

h1 = A[0:N]
h2 = A[N*2:N*3]

heapq.heapify(h1)
heapq._heapify_max(h2)

#print("h1", h1)
#print("h2", h2)
sum_h1[0] = sum(h1)
sum_h2[N] = sum(h2)

for k in range(N):
    #print("A[N+k]", A[N+k])
    #print("k+1", k+1)
    heapq.heappushpop(h1, A[N+k])
    sum_h1[k+1] = sum(h1)

    #print("A[2*N-k-1]", A[2*N-k-1])
    #print("N-k-1", N-k-1)
    _heappush_max(h2, A[2*N-k-1])
    _heappop_max(h2)
    sum_h2[N-k-1] = sum(h2)


mx = None

#print("sum_h1", sum_h1)
#print("sum_h2", sum_h2)

for i in range(N+1):
    a = sum_h1[i] - sum_h2[i]

    if(mx == None or a > mx):
        mx = a

print(mx)

'''
for i in range(N+1):
    h1 = A[0:N+i]
    h2 = A[N+i:N*3]

    heapq.heapify(h1)
    heapq._heapify_max(h2)

    for k in range(N):
        if i <= k:
            _heappop_max(h2)
        else:
            heapq.heappop(h1)

    s = sum(h1) - sum(h2)

    if (mx == None or s > mx):
        mx = s
'''


### FIXED CODE ###

import sys
import heapq
import copy


def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)


def _heappop_max(heap):
    """Maxheap version of a heappop."""
    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt


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

sum_h1 = [0] * (N+1)
sum_h2 = [0] * (N+1)

'''
N=2
0 1 2 3 4 5 6
3 1 4 1 5 9
'''

h1 = A[0:N]
h2 = A[N*2:N*3]

heapq.heapify(h1)
heapq._heapify_max(h2)

#print("h1", h1)
#print("h2", h2)
sum_h1[0] = sum(h1)
sum_h2[N] = sum(h2)

for k in range(N):
    #print("A[N+k]", A[N+k])
    #print("k+1", k+1)

    sum_h1[k+1] = sum_h1[k]
    sum_h1[k+1] += A[N+k]
    a = heapq.heappushpop(h1, A[N+k])
    sum_h1[k+1] -= a

    #sum_h1[k+1] = sum(h1)

    #print("A[2*N-k-1]", A[2*N-k-1])
    #print("N-k-1", N-k-1)

    sum_h2[N-k-1] = sum_h2[N-k]
    sum_h2[N-k-1] += A[2*N-k-1]
    _heappush_max(h2, A[2*N-k-1])
    sum_h2[N-k-1] -= _heappop_max(h2)

    #sum_h2[N-k-1] = sum(h2)


mx = None

#print("sum_h1", sum_h1)
#print("sum_h2", sum_h2)

for i in range(N+1):
    a = sum_h1[i] - sum_h2[i]

    if(mx == None or a > mx):
        mx = a

print(mx)

'''
for i in range(N+1):
    h1 = A[0:N+i]
    h2 = A[N+i:N*3]

    heapq.heapify(h1)
    heapq._heapify_max(h2)

    for k in range(N):
        if i <= k:
            _heappop_max(h2)
        else:
            heapq.heappop(h1)

    s = sum(h1) - sum(h2)

    if (mx == None or s > mx):
        mx = s
'''