Harryxun/stf_run huggingface dataset:
"""
import sys
input = sys.stdin.readline


if __name__ == '__main__':
    main()
"""
n, q = map(int, input().split())
#n, q = map(int, "4 3".split())

g = [[] for _ in range(n)]

for i in range(n-1):
    a, b = map(int, input().split())
    #a, b = map(int, ["1 2", "2 3", "2 4"][i].split())
    g[a-1] += append(b-1)

ans = [0] * n
def dfs(start, point):
    stack = [start]
    while stack:
        x = stack.pop()
        ans[x] += point
        stack += g[x]

for i in range(q):
    p, v = map(int, input().split())
    #p, v = map(int, ["2 10", "1 100", "3 1"][i].split())
    dfs(p-1, v)

#print(' '.join(map(str, ans)))
print(*ans)


### FIXED CODE ###

import sys

def main():
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    n, q = map(int, input().split())
    #n, q = map(int, "4 3".split())
    g = [[] for _ in range(n)]
    for i in range(n-1):
        a, b = map(int, input().split())
        #a, b = map(int, ["1 2", "2 3", "2 4"][i].split())
        g[a-1].append(b-1)
        g[b-1].append(a-1)


    add = [0] * n
    for i in range(q):
        p, v = map(int, input().split())
        #p, v = map(int, ["2 10", "1 100", "3 1"][i].split())
        #dfs(p-1, v)
        add[p-1] += v

    ans = [0] * n
    def dfs(v,p,value): #p: parent of v
        value += add[v]
        ans[v] = value
        for c in g[v]:
            if c == p: continue
            dfs(c,v,value)
    dfs(0, -1, 0)
    """
    def dfs(start, point):
        stack = [start]
        while stack:
            x = stack.pop()
            ans[x] += point
            stack += g[x]
    """

    print(' '.join(map(str, ans)))

if __name__ == '__main__':
    main()
s = input()
k = int(input())

def ones(s):
    ss = s[0]
    idx = 0
    while ss=="1":
        idx += 1
        ss = s[idx]
    return idx

if s[0]!="1":
    print(s[0])
else:
    idx = ones(s)
    if idx>=k:
        print("1")
    else:
        print(s[idx])


### FIXED CODE ###

s = input()
k = int(input())

def ones(s):
    ss = s[0]
    idx = 0
    while ss=="1" and idx+1 < len(s):
        idx += 1
        ss = s[idx]
    return idx

if s[0]!="1":
    print(s[0])
else:
    idx = ones(s)
    if idx>=k:
        print("1")
    else:
        print(s[idx])
'''
参考
https://drken1215.hatenablog.com/entry/2020/06/21/224900
'''
N = int(input())
A = list(map(int, input().split()))

INF = 10 ** 5
cnt = [0] * INF
total = 0

for a in A:
    cnt[a] += 1
    total += a

Q = int(input())

for _ in range(Q):
    B, C = map(int, input().split())
    cnt[C] += cnt[B]
    total += (C-B) * cnt[B]
    cnt[B] = 0
    print(total)


### FIXED CODE ###

'''
参考
https://drken1215.hatenablog.com/entry/2020/06/21/224900
'''
N = int(input())
A = list(map(int, input().split()))

INF = 10 ** 5
cnt = [0] * (INF+1)

Q = int(input())
BC = []

for _ in range(Q):
    BC.append(list(map(int, input().split())))

for a in A:
    cnt[a] += 1

total = sum(A)

for b, c in BC:
    total += (c-b) * cnt[b]
    cnt[c] += cnt[b]
    cnt[b] = 0
    print(total)
r,g,b,n=map(int,input().split())
ans=0
for i in range(n//r+1):
    for j in range(n//g+1):
        if (n-(r*i+g*j))%b==0:
            if (n-(r*i+g*j))//b>=0:
                ans+=1
print(ans)

### FIXED CODE ###

a,b=map(int,input().split())
print(a-(b-1))
# coding: utf-8
import sys
import numpy as np
from fractions import gcd

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, X = lr()
X = np.array(lr())
Xdiff = np.abs(np.diff(X)).tolist()
g = Xdiff[0]
for i in range(1, N):
    g = gcd(g, Xdiff[1])

answer = g
print(answer)


### FIXED CODE ###

import numpy as np
from functools import reduce
from fractions import gcd


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

places = np.array(list(map(int, input().split())))

distances = abs(places - X)

answer = reduce(gcd, distances)
print(answer)
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


h,w = list(map(int, input().split()))
a = [None]*h
for i in range(h):
    a[i] = input()
    if "S" in a[i]:
        start = (i*w+a[i].index("S"))
    if "T" in a[i]:
        goal = (i*w+a[i].index("T"))
if start%w==goal%w or start//w==goal//w:
    val = -1
else:
    import scipy.sparse
    data = []
    rs = []
    cs = []
    def append(u,v):
        data.append(1)
        rs.append(u)
        cs.append(v)
        
    for i in range(h*w):
        if i not in (start, goal):
            append(2*i, 2*i+1)
    start = start*2+1
    goal = goal*2
    def add(i0,j0,i1,j1):
        u = i0*w+j0
        v = i1*w+j1
        append(2*u+1, 2*v)
#         append(2*v+1, 2*u)
    for i in range(h):
        index = []
        for j in range(w):
            if a[i][j] in ("o", "S", "T"):
                index.append(j)
        for x in index:
            for y in index:
                if x!=y:
                    add(i,x,i,y)
    for j in range(w):
        index = []
        for i in range(h):
            if a[i][j] in ("o", "S", "T"):
                index.append(i)
        for x in index:
            for y in index:
                if x!=y:
                    add(x,j,y,j)
    m = scipy.sparse.csr_matrix((data, (rs, cs)), shape=(2*h*w, 2*h*w))
    val = scipy.sparse.csgraph.maximum_flow(m, start, goal) # startからの最短路木を求める
print(val.flow_value)

### FIXED CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


h,w = list(map(int, input().split()))
data= []
rs = []
cs = []
for i in range(h):
    c = input()
    if "S" in c:
        start = (i, c.index("S"))
    if "T" in c:
        goal = (i, c.index("T"))
    for j in range(w):
        if c[j] in ("o"):#, "S", "T"):
            data.append(1)
            rs.append(i)
            cs.append(h+j)
            data.append(1)
            rs.append(h+j)
            cs.append(i)
s = h+w
t = h+w+1
V = 10**9
data.append(V)
rs.append(s)
cs.append(start[0])
data.append(V)
rs.append(start[0])
cs.append(s)

data.append(V)
rs.append(s)
cs.append(start[1]+h)
data.append(V)
rs.append(start[1]+h)
cs.append(s)

data.append(V)
rs.append(goal[0])
cs.append(t)
data.append(V)
rs.append(t)
cs.append(goal[0])

data.append(V)
rs.append(t)
cs.append(goal[1]+h)
data.append(V)
rs.append(goal[1]+h)
cs.append(t)

import scipy.sparse
m = scipy.sparse.csr_matrix((data, (rs, cs)), shape=(h+w+2,h+w+2))
val = scipy.sparse.csgraph.maximum_flow(m, s, t).flow_value
if val>=10**9:
    val = -1
print(val)
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
c = 0
for i in range(n - 1):
    j = np.argmin(a[i:]) + i
    if i != j:
        a[i], a[j] = a[j], a[i]
        c += 1
print(" ".join(map(str, list(a))))
print(c)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
c = 0
for i in range(n - 1):
    j = a[i:].index(min(a[i:])) + i
    if i != j:
        a[i], a[j] = a[j], a[i]
        c += 1
print(" ".join(map(str, a)))
print(c)
input()
nums = lint(map(int, input().split()))
count = 0
flg = True
while flg:
  for i, n in enumerate(nums):
    if n % 2 == 1:
      flg = False
      break
    else:
      nums[i] = n / 2
      count += 1
print(count)
      

### FIXED CODE ###

kazu = int(input())
nums = list(map(int, input().split()))
count = 0
flg = True
while flg:
  for i in range(kazu):
    if nums[i] % 2 == 1:
      flg = False
      break
    else:
      nums[i] /= 2
  count += 1
count -= 1
print(count)
n = int(input())
a = list(map(int,input().split()))
a.sort()
print(a[n//2+1]-a[n//2])

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort()
print(a[n//2]-a[n//2-1])
M=input(int())

print(M+24)


### FIXED CODE ###

M = int(input())
print(48-M)
def resolve():
    n, c, k = map(int, input().split())
    t = list(int(input()) for _ in range(n))
    t.sort()
    ans = 0
    limit = t[0] + k
    bus = 0
    for i in range(n):
        if t[i] <= limit:
            bus += 1
            if bus == c:
                ans += 1
                bus = 0
                if i < n:
                    limit = t[i + 1] + k
        else:
            ans += 1
            bus = 1
            limit = t[i] + k
    if bus > 0:
        ans += 1
    print(ans)


if __name__ == "__main__":
    resolve()


### FIXED CODE ###

def resolve():
    n, c, k = map(int, input().split())
    t = list(int(input()) for _ in range(n))
    t.sort()
    ans = 1
    limit = t[0] + k
    bus = 0
    for i in range(n):
        bus += 1
        if t[i] > limit or bus > c:
            limit = t[i] + k
            ans += 1
            bus = 1
    print(ans)


if __name__ == "__main__":
    resolve()
from sys import stdin, setrecursionlimit

setrecursionlimit(200000)

n, q = [int(x) for x in input().split()]

tree = [[] for _ in range(n + 1)]
cnt = [0] * (n + 1)

for _ in range(n - 1):
    a, b = [int(x) for x in stdin.readline().split()]
    tree[a].append(b)

# TLE/RE

def walk(p, x):
    cnt[p] += x
    for n in tree[p]:
        walk(n, x)


for _ in range(q):
    p, x = [int(x) for x in stdin.readline().split()]
    walk(p, x)

for i in range(1, n + 1):
    print(cnt[i], end=" ")


### FIXED CODE ###

from sys import stdin, setrecursionlimit

setrecursionlimit(1000000)


def main():
    def read_tree(n):
        parents = [0 for _ in range(n + 1)]
        for _ in range(n - 1):
            a, b = [int(x) for x in input().split()]
            parents[b] = a
        return parents

    n, q = [int(x) for x in input().split()]

    parents = read_tree(n)
    cnt = [0] * (n + 1)

    for _ in range(q):
        p, x = [int(x) for x in input().split()]
        cnt[p] += x
    
    for i in range(1, n + 1):
        cnt[i] += cnt[parents[i]]

    for i in range(1, n + 1):
        print(cnt[i], end=" ")


main()
l,r=list(map(int,input().split()))
s=[]
if r-l>2050:
  print(0)
else:
  for i in range(l,r+1):
    s.append(i%2019)
  s.sort()
  print(s[0]*s[1])
  
  

### FIXED CODE ###

s=list(input())
s=s+["R"]
n=len(s)-1
ans_list=[0 for i in range(n)]

flg_1=0
flg_2=0
start=0
for i in range(1,n+1):
  if s[i-1]=="R" and s[i]=="L":
    flg_1=i
  elif s[i-1]=="L" and s[i]=="R":
    flg_2=i
    if (flg_2-start)%2==0:
      if (flg_1-start)%2!=0:
        ans_list[flg_1-1]=(flg_2-start)//2
        ans_list[flg_1]=(flg_2-start)//2
      else:
        ans_list[flg_1-1]=(flg_2-start)//2
        ans_list[flg_1]=(flg_2-start)//2
    else:
      if (flg_1-start)%2!=0:
        ans_list[flg_1-1]=(flg_2-start)//2+1
        ans_list[flg_1]=(flg_2-start)//2
      else:
        ans_list[flg_1-1]=(flg_2-start)//2
        ans_list[flg_1]=(flg_2-start)//2+1
    start=i

for i in ans_list:
  print(str(i)+str(" "),end="")
K = int(input())
S = input()

for i in range(K):
    print(S[i],end="")
print("...")

### FIXED CODE ###

K = int(input())
S = input()

if len(S) > K:
    for i in range(K):
        print(S[i],end="")
    print("...")
else:
    print(S)
A = input()

if A >= 1000:
  print("ABD")
else:
  print("ABC")

### FIXED CODE ###

A = int(input())

if A >= 1000:
  print("ABD")
else:
  print("ABC")
for i in range(1:10):
    for j in range(1:10):
        print(i*j)

### FIXED CODE ###

for i in range(1,10):
    for j in range(1,10):
        print("{}x{}={}".format(i,j,i*j))
A,B =map(int,input().split())
for i in range(1,4,1):
    if (A*B*C) %2 ==1:
        print("Yes")
print("No")


### FIXED CODE ###

A,B =map(int,input().split())
for i in range(1,4,1):
    if (A*B*i) %2 ==1:
        print("Yes")
        exit()
print("No")
h, w = map(int, input().split())
if h % 3 == 0 or w % 3 == 0:
    print(0)
else:
    if h > w:
        h, w = w, h
    ans = h
    if h % 2 == 0:
        h1 = h // 2
        for w1 in range(w//2+1):
            s2 = h1 * w1
            s3 = h1 * (w-w1)
            ans = min(ans, max(s1, s2, s3) - min(s1, s2, s3))
    else:
        for w1 in range(w//3, w//2 + 1):
            s1 = w1 * h
            w2 = w-w1
            for h1 in range(h//2 + 1):
                s2 = w2 * h1
                s3 = w2 * (h-h1)
                ans = min(ans, max(s1, s2, s3) - min(s1, s2, s3))
    print(ans)

### FIXED CODE ###

h, w = map(int, input().split())
if h % 3 == 0 or w % 3 == 0:
    print(0)
else:
    if h > w:
        h, w = w, h
    ans = h
    for w1 in range(w//3-2, w//3+3):
        s1 = w1 * h
        w2 = w-w1
        for h1 in range(h//2 + 1):
            s2 = w2 * h1
            s3 = w2 * (h-h1)
            ans = min(ans, max(s1, s2, s3) - min(s1, s2, s3))
    h, w = w, h
    for w1 in range(w//3-2, w//3+3):
        s1 = w1 * h
        w2 = w-w1
        for h1 in range(h//2 + 1):
            s2 = w2 * h1
            s3 = w2 * (h-h1)
            ans = min(ans, max(s1, s2, s3) - min(s1, s2, s3))
    print(ans)
def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    a, b = [0], [0]
    for i in range(N):
        a.append(a[i] + A[i])
    for i in range(M):
        a.append(b[i] + B[i])

    ans, j = 0, M
    for i in range(N + 1):
        if a[i] > K:
            break

        while a[i] + b[j] > K:
            j -= 1

        ans = max(ans, i + j)

    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    a, b = [0], [0]
    for i in range(N):
        a.append(a[i] + A[i])
    for i in range(M):
        b.append(b[i] + B[i])

    ans, j = 0, M
    for i in range(N + 1):
        if a[i] > K:
            break

        while a[i] + b[j] > K:
            j -= 1

        ans = max(ans, i + j)

    print(ans)


if __name__ == "__main__":
    main()
N = int(input())

dicts = {}

for _ in range(N):
    S = input()
    if S in dicts:
        dicts[S] += 1
    else:
        dicts[S] = 1

max_list = [kv[0] for kv in d.items() if kv[1] == max(dicts.values())]

print(sorted(max_list))

### FIXED CODE ###

N = int(input())

dicts = {}

for _ in range(N):
    S = input()
    if S in dicts:
        dicts[S] += 1
    else:
        dicts[S] = 1

dicts = sorted(dicts.items(), key=lambda x:x[1], reverse=True)
max_list = []

buf = dicts[0][1]
for k, v in dicts:
    if v == buf:
        max_list.append(k)
    else:
        break

for k in sorted(max_list):
    print(k)
N = int(input())

min_f = len(N)
for a in range(1, N):
  if N % a != 0:
    continue
  b = int(N / a)
  f = max(len(str(a)), len(str(b)))
  if min_f > f:
    min_f = f
  if a**2 > N:
    break

print(min_f)

### FIXED CODE ###

import math

N = int(input())

min_f = len(str(N))
for a in range(1, int(math.sqrt(N)) + 1):
  if N % a != 0:
    continue
  b = int(N / a)
  f = max(len(str(a)), len(str(b)))
  if min_f > f:
    min_f = f

print(min_f)
n, k, x, y = [map(int(input()), for i in range(4))]
print(x*n - (x - y)*max(0, n - k))


### FIXED CODE ###

n,k,x,y=[int(input()) for i in range(4)]
print(n*x-(x-y)*max(n-k,0))
a, b = map(int, input().split())
if a - 2*b > 0
    print(a - 2*b)
else:
    print(0)

### FIXED CODE ###

a, b = map(int, input().split())
if a - 2*b > 0:
    print(a - 2*b)
else:
    print(0)
if int(input())<30: print('No')
  else: print('Yes')

### FIXED CODE ###

if int(input())<30: print('No')
else: print('Yes')
def solve():
  n, m = map(int,input().split())
  plst = list(map(int,input().split()))
  pare_inds = [i for i in range(n)]
  belongs = [[] for i in range(n)]
  
  def get_root(x):
    p = pare_inds[x]
    if p == x:
      return (x, 0)
    a = get_root(p)
    pare_inds[x] = a
    return a
  
  for i in range(m):
    x, y = map(int,input().split())
    x, y = x - 1, y - 1
    r_x, r_y  = get_root(x), get_root(y)
    if r_x < r_y:
      pare_inds[y] = r_x
      pare_inds[r_y] = r_x
    else:
      pare_inds[x] = r_y
      pare_inds[r_x] = r_y
  
  for i in range(n):
    belongs[get_root(i)].append(i)
  
  ans = 0
  for lst in belongs:
    for i in lst:
      if plst[i] - 1 in lst:
        ans += 1
  
  print(ans)
solve()

### FIXED CODE ###

def solve():
  n, m = map(int,input().split())
  plst = list(map(int,input().split()))
  pare_inds = [i for i in range(n)]
  belongs = [[] for i in range(n)]
  
  def get_root(x):
    p = pare_inds[x]
    if p == x:
      return x
    a = get_root(p)
    pare_inds[x] = a
    return a
  
  for i in range(m):
    x, y = map(int,input().split())
    x, y = x - 1, y - 1
    r_x, r_y  = get_root(x), get_root(y)
    if r_x < r_y:
      pare_inds[y] = r_x
      pare_inds[r_y] = r_x
    else:
      pare_inds[x] = r_y
      pare_inds[r_x] = r_y
  
  for i in range(n):
    belongs[get_root(i)].append(i)
  #print(belongs)
  #print(plst)
  ans = 0
  for lst in belongs:
    lst2 = [plst[i] - 1 for i in lst]
    lst.sort()
    lst2.sort()
    ind1 = 0
    ind2 = 0
    end = len(lst)
    while ind1 < end and ind2 < end:
      if lst[ind1] == lst2[ind2]:
        ans += 1
        ind1 += 1
        ind2 += 1
      elif lst[ind1] < lst2[ind2]:
        ind1 += 1
      else:
        ind2 += 1
  
  print(ans)
solve()
total, tar = list(map(int, input().split()))
dice_array = list(map(int, input().split()))

dice_total = [0]

for i in range(total):
  dice_total.append(dice_array[i] + dice_total[i])

ans = dice_total[tar]
tar_num = tar
for i in range(total - tar):
  tmp = dice_total[i + 1 + tar] - dice_total[i + 1]
  if ans < tmp:
    ans = tmp
    tar_num = i + 1

sum_data = 0
cnt = 0
for x in range(tar_num, tar + tar_num):
  sum_data += (dice_array[x] * (dice_array[x] + 1)) / 2 / dice_array[x]
  
print(sum_data)


### FIXED CODE ###

total, tar = list(map(int, input().split()))
dice_array = list(map(int, input().split()))

hope_array = [0.0] * total
for i in range(total):
   hope_array[i] = (dice_array[i] * (dice_array[i] + 1)) / 2 / dice_array[i]

dice_total = [0]
 
for i in range(total):
  dice_total.append(hope_array[i] + dice_total[i])
 
ans = dice_total[tar]
tar_num = tar
for i in range(total - tar):
  tmp = dice_total[i + 1 + tar] - dice_total[i + 1]
  if ans < tmp:
    ans = tmp

print(ans)
s, w = map(int, input().split()) # split()で空白区切りでリスト化、その際map()でint型にキャストし変数に代入。
if s > w
	print("safe")
else
	print("unsafe")

### FIXED CODE ###

s, w = map(int, input().split()) # split()で空白区切りでリスト化、その際map()でint型にキャストし変数に代入。
if s > w:
	print("safe")
else:
	print("unsafe")
import math
N=int(input())
a = list(map(int, input().split()))

#------------最小公倍数---------------------
lcm = a[0]
for i in range(1, N):
    lcm = lcm * a[i] // math.gcd(lcm, a[i])
#------------------------------------------
ans =0


for j in a:
    ans += lcm // j
ans %= 1000000007
print(ans)

### FIXED CODE ###

import fractions
N=int(input())
a = list(map(int, input().split()))

#------------最小公倍数---------------------
lcm = a[0]
for i in range(1, N):
    lcm = lcm * a[i] // fractions.gcd(lcm, a[i])
#------------------------------------------
ans=0
for j in a:
    ans += lcm // j
print(ans % 1000000007)
num = input()
get = num // 15
print(num * 800 - get * 200)

### FIXED CODE ###

num = int(input())
get = num // 15

print((num * 800) - (get * 200))
S=input(sheeps:)
W=input(wolfs:)

if S>W:
  print("safe")
else:
  print("unsafe")

### FIXED CODE ###

s,w=map(int,input().split())

if s>w:
  print("safe")
else:
  print("unsafe")
a,b = input().split()

a = int(a)
del b[-3]
b = int(b)
ans = a*b
print(ans//100)

### FIXED CODE ###

a,b = input().split()
 
a = int(a)
b = list(b)
del b[-3]
b = int(''.join(b))
ans = a*b
print(ans//100)
n = int(input())
a = [int(input()) for _ in range(n)]

def f(a, offset=0):
    ans = 0
    # if len(a) % 2 == 0:
    #     last = a[0]
    # else:
    init = n // 2 + offset
    last = a[init]
    for i in range(n - 1):
        j = i // 2 if i % 2 == 0 else n - 1 - i // 2
        if j == init:
            break
        ans += abs(a[j] - last)
        last = a[j]
    return ans

# print(f(sorted(a)))
# print(f(sorted(a, reverse=True)))
a = sorted(a)
arev = sorted(a, reverse=True)
print(max(
    f(a),
    f(arev),
    f(a, offset = 1),
    f(arev, offset = 1),
))


### FIXED CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]

def f(a, offset=0):
    global n
    ans = 0
    # if len(a) % 2 == 0:
    #     last = a[0]
    # else:
    init = min(n // 2 + offset, n - 1)
    last = a[init]
    for i in range(n - 1):
        j = i // 2 if i % 2 == 0 else n - 1 - i // 2
        if j == init:
            break
        ans += abs(a[j] - last)
        last = a[j]
    return ans

# print(f(sorted(a)))
# print(f(sorted(a, reverse=True)))
a = sorted(a)
arev = sorted(a, reverse=True)
print(max(
    f(a),
    f(arev),
    f(a, offset = 1),
    f(arev, offset = 1),
))
second=input()
first=splitlines(second)
P=string(first[0])
S=string(first[1])
count=0
for t in range(0,len(P)-1):
  if P[t] is S[t]:count=count+1
#    else:
#      count=count
print(int(count))

### FIXED CODE ###

a=[input() for i in range(2)]
P=a[0]
S=a[1]
count=0
for t in range(len(P)):
  if P[t] != S[t]:
    count=count+1
print(count)
n=int(input())
s,l=[],[]
s=[input() for i in range(n)]
for i in s:
  if i not in l:
      l.append(i)
print(len(l))

### FIXED CODE ###

s,w=map(int,input().split())
if w>=s:
	print("unsafe")
else:
	print("safe")
a=[int(input().split())]
print(max(a)-min(a))

### FIXED CODE ###

*a,=map(int,input().split())
print(max(a)-min(a))
# -*- coding: utf-8 -*-
import sys
N,M=list(map(int,raw_input().split()))

nl=[[] for i in range(N+1)]
for i in range(M):
	x,y=map(int,raw_input().split())
	nl[x].append(y)
	nl[y].append(x)	
#print nl


def dfs(v,p):
	F[v]=1
	global bip_graph
	for i in nl[v]:
		if color[v]=="w" and color[i]==0:
			color[i]="b"
		elif color[v]=="b" and color[i]==0:
			color[i]="w"				
		elif color[v]==color[i]:
			#二分木ではない
			print N*(N-1)/2-M
			sys.exit()
		#print v,i,color,F
		
		if F[i]==0:
			#DFS(次の頂点i, 次に親となる頂点v, d+ 頂点vと頂点iの間の辺のコスト)
			dfs(i,v)


bip_graph="YES"
F=[0]*(N+1)
color=[0]*(N+1)
color[1]="w"
dfs(1,-1)


print color.count("b")*color.count("w")-M





### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**7)
N,M=list(map(int,raw_input().split()))

nl=[[] for i in range(N+1)]
for i in range(M):
	x,y=map(int,raw_input().split())
	nl[x].append(y)
	nl[y].append(x)	
#print nl


def dfs(v):
	F[v]=1
	for i in nl[v]:
		if color[v]=="w" and color[i]==0:
			color[i]="b"
		elif color[v]=="b" and color[i]==0:
			color[i]="w"				
		elif color[v]==color[i]:
			#２部グラフではない
			print N*(N-1)/2-M
			sys.exit()
		else:
			continue
		#print v,i,color,F
		
		if F[i]==0:
			dfs(i)


F=[0]*(N+1)
color=[0]*(N+1)
color[1]="w"
dfs(1)

#２部グラフの場合
print color.count("b")*color.count("w")-M
n = int(input())
s=[]
alp = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
word = []
while n > 0:
    s.append(n % 26)
    n = n // 26
for m in s:
    if m == 0:
        word.append(z)
    else:
        word.append(alp[m-1])
word.reverse()
print("".join(word))

### FIXED CODE ###

from collections import deque
n = int(input())
st  = deque()
while n > 0:
    num = (n - 1) % 26
    n = (n - 1) // 26
    st.appendleft(chr(num + 97))
print(*st, sep = "")