Harryxun/stf_run huggingface dataset:
N = int(input())
b_list = list(map(int,input().split()))
answer_list = []

for i in range(N):
    if b_list[i] > i+1:
        print(-1)
        break

for i in range(N): 
    
    for j in range(N-i, 0, -1):
        
        if b_list[j-1] == j:
            answer_list.append(b_list[j-1])
            b_list.pop(j-1)
            
            break

answer_list.reverse()


for i in range(N):
    print(answer_list[i])

### FIXED CODE ###

N = int(input())
b_list = list(map(int,input().split()))
answer_list = []
check = 0

for i in range(N):
    if b_list[i] > i+1:
        print(-1)
        check = 1
        break

if check == 0:
    for i in range(N):     
        for j in range(N-i, 0, -1):
            
            if b_list[j-1] == j:
                answer_list.append(b_list[j-1])
                b_list.pop(j-1)
                
                break

    answer_list.reverse()


    for i in range(N):
        print(answer_list[i])
A, B  map(int, input().split())
print((A-1)*(B-1))

### FIXED CODE ###

A, B = map(int, input().split())
print((A-1)*(B-1))
import math

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

B = [0] * (N - 1)
C = [0] * (N - 1)

for n in range(N - 1):
    if n == 0:
        B[0] = A[0]
        C[N - 2] = A[N - 1]
    else:
        B[n] = math.gcd(B[n - 1], A[n])
        C[N - n - 2] = math.gcd(A[N - n - 1], C[N - n - 1])

ans = 0
for n in range(N):
    if n == 0:
        ans = C[0]
    elif n == N - 1:
        ans = max(ans, B[N - 2])
    else:
        ans = max(ans, math.gcd(B[n - 1], C[n]))
print(ans)

### FIXED CODE ###

from fractions import gcd

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

B = [0] * (N - 1)
C = [0] * (N - 1)

for n in range(N - 1):
    if n == 0:
        B[0] = A[0]
        C[N - 2] = A[N - 1]
    else:
        B[n] = gcd(B[n - 1], A[n])
        C[N - n - 2] = gcd(A[N - n - 1], C[N - n - 1])

ans = 0
for n in range(N):
    if n == 0:
        ans = C[0]
    elif n == N - 1:
        ans = max(ans, B[N - 2])
    else:
        ans = max(ans, gcd(B[n - 1], C[n]))
print(ans)
n=int(input())
s=input()

if n % 2 == 1:
  print('No')
  return

half = n / 2

ans = "Yes" if s[:half] == s[half:] else "No"
print(ans)

### FIXED CODE ###

n = int(input())
s = input()
if n % 2:
    print("No")
    exit()
half = s[0:n // 2]
print("Yes" if s == half + half else "No")
from itertools import accumulate
from bisect import bisect_left
from math import ceil

file = open("ABC085D.txt","r")

N,H = map(int, file.readline().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, file.readline().split())
    A.append(a)
    B.append(b)
    
# 最も強いaを探す
a_max = max(A)

# それ以上のbを探す
b_strong = []
for b in B:
    if b >= a_max:
        b_strong.append(b)
        
# bをソートしてcum作る
b_strong.sort(reverse=True)
b_cum = list(accumulate(b_strong))
b_cum = [0] + b_cum
    
# もしHPがb_cum[-1]なら投げてるうちに倒せる
if H <= b_cum[-1]:
    ans = bisect_left(b_cum, H)
    
else:
    ans = len(b_cum) - 1
    ans += ceil((H - b_cum[-1]) / a_max)
    
print(ans)

### FIXED CODE ###

from itertools import accumulate
from bisect import bisect_left
from math import ceil

N,H = map(int, input().split())
AB = []
for _ in range(N):
    AB.append(tuple(map(int, input().split())))

# A昇順、B降順にソート
AB.sort(key=lambda x: (x[0], -x[1]))

# 最後の刀を装備する
equip = AB.pop()

# a_max < b なる刀を集める
b_list = []
for a,b in AB:
    if b > equip[0]:
        b_list.append(b)

# bを攻撃力の高い順に並べ替える
b_list.sort(reverse=True)
b_list_cum = list(accumulate(b_list))
b_list_cum = [0] + b_list_cum
 
ans = 0
# hpがb_list_cum[-1]以下なら、刀投げで終わる
if H <= b_list_cum[-1]:
    ans = bisect_left(b_list_cum,H)
    print(ans)

# 違えば、まずはb>=a_maxなる刀を全部投げ、equipでhp<=bになるまで攻撃し、
# 最後の1手で刀を投げる
else:
    ans = len(b_list_cum)-1
    res = H - b_list_cum[-1]
    a_attack = max(0, int(ceil((res-equip[1]) / equip[0])))
    
    # aで攻撃した分と、最後の1手の刀投げの分を足す
    ans += (a_attack + 1)
    print(ans)
import itertools
import math


def gcd(a,b):
    while b:
        a, b = b, a % b
    return a


def lcm(left, right):
    return (int(left) * int(right)) / int(gcd(left, right))


N = int(input().strip())
Ts = []
for i in range(N):
    Ts.append(int(input().strip()))

res = 0
if len(Ts) == 0:
    res = 0
elif len(Ts) == 1:
    res = Ts[0]
else:
    res = int(lcm(Ts[0], Ts[1]))
    for T in Ts[2:]:
        res = int(lcm(res, T))

print(str(int(res)))

### FIXED CODE ###

import itertools
import math


def gcd(a,b):
    while b:
        a, b = b, a % b
    return a


def lcm(left, right):
    return (left * right) // gcd(left, right)


N = int(input().strip())
Ts = []
for i in range(N):
    Ts.append(int(input().strip()))

res = 0
if len(Ts) == 0:
    res = 0
elif len(Ts) == 1:
    res = Ts[0]
else:
    res = int(lcm(Ts[0], Ts[1]))
    for T in Ts[2:]:
        res = int(lcm(res, T))

print(str(int(res)))
n,k = list(map(int,input().split()))
A = list(map(int,input().split()))
tour=[0]
next_town = 0
for i in range(n*2):
    next_town=A[next_town]-1
    if next_town in tour:
        first_roop_idx = tour.index(next_town)
        break
    tour.append(next_town)
print(tour)
if k<=len(tour):
    ans = tour[k]
else:
    k-=first_roop_idx
    ans = tour[k%(len(tour)+first_roop_idx)+first_roop_idx-1]
print(ans)


### FIXED CODE ###

n,k = list(map(int,input().split()))
A = list(map(int,input().split()))
tour=[0]
visited=[0]*n
visited[0]=1
next_town = 0
flag=False
for i in range(n):
    next_town=A[next_town]-1
    if i+1==k:
        flag = True
        ans = next_town
        break
    if next_town==0:
        first_roop_idx = 0
        break
    if visited[next_town]>0:
        first_roop_idx = visited[next_town]
        break
    tour.append(next_town)
    visited[next_town]=i+1
#print(tour)
#print(visited)
#print(first_roop_idx)
if not flag:
    if k<=len(tour):
        ans = tour[k]
    else:
        k-=first_roop_idx
        #print("k=",k)
        if len(tour)-first_roop_idx==0:
            k=0
        else:k=k%(len(tour)-first_roop_idx)
        #print("k=",k)
        ans = tour[first_roop_idx+k]
print(ans+1)
#print(flag)
import collections
import heapq
n=int(input())
a=[-int(item) for item in input().split()]
c = [item for item in list(collections.Counter(a).items()) if item[1]>1]
if c==[]:
  print(0)
  exit()
#print(c)
x=heapq.heappop(c)
y=heapq.heappop(c)
kouho=[]
if x[1]>=4:
  print(x*x)
else:
  print(x*y)

### FIXED CODE ###

import collections
import heapq
n=int(input())
a=[-int(item) for item in input().split()]
c = [item for item in list(collections.Counter(a).items()) if item[1]>1]
heapq.heapify(c)
#print(c)

if len(c)==0:
  print(0)
  exit()
if sum([item[1] for item in c])<4:
  print(0)
  exit()

x=heapq.heappop(c)
if c!=[]:
  y=heapq.heappop(c)
else:
  y=(0,0)
if x[1]>=4:
  print(x[0]*x[0])
else:
  print(x[0]*y[0])
#
N, A, B = list(map(int, input().rstpir().split()))

#
if (B-A-1)%2==0:
    print('Borys')
else:
    print('Alice')


### FIXED CODE ###

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

#
if (B-A-1)%2==0:
    print('Borys')
else:
    print('Alice')
import math
N = int(input())
D = [int(x) for x in input().split()]

num = [0] * 10000

for d in D:
    num[d] += 1

if D[0] != 0 or num[0] != 1:
    ans = 0
else:
    ans = 1
    for i in range(1, max(num)):
        ans *= int(math.pow(num[i], num[i+1])) % 998244353
        if ans == 0:
            break
print(ans)


### FIXED CODE ###

import math
N = int(input())
D = [int(x) for x in input().split()]

num = [0] * 100000

maxd = 0
for d in D:
    num[d] += 1
    maxd = max(d, maxd)

if D[0] != 0 or num[0] != 1:
    ans = 0
else:
    ans = 1
    for i in range(1, maxd):
        for _ in range(num[i+1]):
            ans *= num[i]%998244353
        ans %= 998244353
        if ans == 0:
            break
print(ans%998244353)
a,b = input().split()
print(max(0,a-2*b))

### FIXED CODE ###

a,b = input().split()
a,b = int(a),int(b)
print(max(a-2*b,0))
N=input()
print(1+N/1000)

### FIXED CODE ###

print((10000-int(input()))%1000)
import sys
import numpy as np
input = sys.stdin.readline
H, W = map(int, input().split())
a = [list(input().strip()) for _ in range(H)]
a = [ai for ai in a if "#" in ai]
H = len(a)
a_T = np.array(a).T
a_T = [ai for ai in a_T if "#" in ai]
a = np.array(a_T).T
W = len(a[0])
for i in range(H):
    for j in range(W):
        print(a[i][j],end="")
    print("")

### FIXED CODE ###

import sys
import numpy as np
input = sys.stdin.readline
H, W = map(int, input().split())
a = [list(input().strip()) for _ in range(H)]
a = [ai for ai in a if "#" in ai]
H = len(a)
a_T = np.array(a).T
a_T = [ai for ai in a_T if "#" in ai]
a = np.array(a_T).T
W = len(a[0])
for i in range(H):
    for j in range(W):
        print(a[i][j],end="")
    print("")
a = list(map(int,input().split()))
print((a[1]-a[0]+1)//a[2])

### FIXED CODE ###

a = input().split(" ")
print(a[0][0]+a[1][0]+a[2][0])
p, q, r = map(int, input().split())
print(sum(p, q, r) - max(p, q, r))



### FIXED CODE ###

a,b,c=map(int,input().split())
A=[a,b,c]
print(sum(A)-max(A))
input_line = input()
x = input_line.split()
a = x[0]
b = x[1]
c = x[2]
d = x[3]

xy1 = a*c
xy2 = a*d
xy3 = b*c
xy4 = b*d

print(max([xy1, xy2, xy3, xy4]))

### FIXED CODE ###

a, b, c, d = input().split() 
a = int(a)
b = int(b)
c = int(c)
d = int(d)
xy1 = a*c
xy2 = a*d
xy3 = b*c
xy4 = b*d
 
print(max([xy1, xy2, xy3, xy4]))
A, B = map(int, input().split())
ans = 0
cnt = 0
def f(arg):
    ans = 0
    for pos in range(40):
        v = 1 << pos
        if v > arg:
            break
        cnt = sum([(n & v) / v for n in range(arg+1)])
        ans += int(cnt%2) << pos
        # print(pos, v, cnt, ans)
    return ans
print(f(A-1)^f(B))


### FIXED CODE ###

A, B = map(int, input().split())
ans = 0
cnt = 0
def f(arg):
    ans = 0
    if arg < 0:
        return 0
    for pos in range(1, 41):
        # ループする数
        loop = 1 << pos
        # cnt = sum([int((n & v) / v) for n in range(arg+1)])
        cnt = int((arg + 1) / loop) * (loop >> 1)
        cnt += max(0, (arg + 1) % (loop) - (loop >> 1))
        ans += cnt%2 * (loop>>1)
        # print(arg, pos, loop, cnt, ans)
        if loop > arg:
            break
    return ans
print(f(A-1)^f(B))
import sys

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

for i in range(N+1):
    if Y < i * 10000:
        continue
    for j in range(N+1):
        if N < i + j or Y < i * 10000 + 5000 * j:
            break
        for k in range(N+1):
          	if N < i + j + k or Y < i * 10000 + j * 5000 + k * 1000:
                break
            if N == i + j + k and Y == i * 10000 + j * 5000 + k * 1000:
				print(i,j,k)
                sys.exit()
print("-1 -1 -1")

### FIXED CODE ###

import sys

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

for i in range(N+1):
    for j in range(N+1):
        k = N - i - j

        if k >= 0 and Y == i * 10000 + j * 5000 + k * 1000:
            print(i,j,k)
            sys.exit()
print("-1 -1 -1")
a,b = map(int,input(),split())
if a*b%2==0:
  print('Even')
else:
  print('Odd')

### FIXED CODE ###

a,b = map(int,input().split())
if (a * b) % 2:
  print('Odd')
else:
  print('Even')
N = int(input())
H = list(map(lambda x:int(x), input().split()))

ans = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    count += 1
  else:
    count = 0
  ans = max(ans, count)

print(ans)

### FIXED CODE ###

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

print(ans)
s = input()
k = int(input())

if s[0] == '1':
  print(s[1])
else:
  print(s[0])

### FIXED CODE ###

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

if s[0] == '1' and len(s) == 1:
  print(1)
  exit()
elif s[0] != '1':
  print(s[0])
  exit()

if k > 100:
  for i in s:
    if i != '1':
      print(i)
      exit()
  print(1)
  
else:
  for i in s[:k]:
    if i != '1':
      print(i)
      exit()
  print(1)
  exit()
total = (int)input()
s = total%3600
m = (total-(s/60))%60
h = total-(s/3600)-(m/60)

### FIXED CODE ###

total = int(input())

h = total // 3600
m = (total - 3600*h) // 60
s = total - 3600*h - 60*m

print("{0}:{1}:{2}".format(h, m, s))
x = input()
if x =< 599:
    print("8")
elif x=< 799:
    print("7")
elif x=< 999:
    print("6")
elif x=< 1199:
    print("5")
elif x=< 1399:
    print("4")
elif x=< 1599:
    print("3")
elif x=< 1799:
    print("2")
else:
    print("1")

### FIXED CODE ###

x = int(input())
if x <= 599:
    print("8")
elif x <= 799:
    print("7")
elif x <= 999:
    print("6")
elif x <= 1199:
    print("5")
elif x <= 1399:
    print("4")
elif x <= 1599:
    print("3")
elif x <= 1799:
    print("2")
else:
    print("1")
import sys
import numpy as np
N, K = map(int, raw_input().split())
A = np.array(map(int, raw_input().split()))
A = np.sort(A)
Sum = A.sum()
if Sum < K:
    print N
    sys.exit()
   
A_cumsum = np.concatenate(([0], np.cumsum(A)))
I = np.where(A_cumsum<K)[0][-1] + 1

Sum_ = A_cumsum[I]
while Sum_ > K:
    for J in xrange(I-1, -1, -1):
        if A[J] <= Sum_ - K:
            break
    I = J + 1
    Sum_ = A_cumsum[I]

print I

### FIXED CODE ###

from math import sqrt
X = int(raw_input())

ans = 0
Init = int(sqrt(2*X)) + 1
for N in xrange(X+1):
    if (N+1) * N >= 2 * X:
        ans = N
        break
    
print ans
from collections import defaultdict
from math import factorial

N = int(input())
st = set()
d = defaultdict(int)
for _ in range(N):
    s = input()
    s_sorted = "".join(sorted(s))
    if s_sorted in st:
        d[s_sorted] += 1
    else:
        st.add(s_sorted)

ans = 0
for _, v in d.items():
    tmp = v + 1
    x = factorial(tmp) / factorial(2) / factorial(tmp - 2)
    ans += x

print(round(ans))


### FIXED CODE ###

from math import factorial

N = int(input())
d = {}
for _ in range(N):
    s = input()
    s_sorted = "".join(sorted(s))
    if not d.get(s_sorted):
        d[s_sorted] = 1
    else:
        d[s_sorted] += 1

ans = 0
for _, v in d.items():
    if v == 1:
        continue
    ans += v * (v - 1) // 2

print(round(ans))
import copy

def greedy(N,L,ices):
    counts = 1
    while True:
        # print(ices)
        copied = copy.deepcopy(ices)
        for i in range(len(ices)):
            if copied[i] != 0:
                if 0 < i < N-1:
                    if copied[i] >= L:
                        ices[i] = 0
                        break
                    if copied[i] > copied[i-1] and copied[i] > copied[i+1]:
                        ices[i] += 1
                        if ices[i] >= L:
                            ices[i] = 0
                elif i == 0:
                    if copied[i] >= L:
                        ices[i] = 0
                        break
                    if copied[i] > copied[1]:
                        ices[i] += 1
                        if ices[i] >= L:
                            ices[i] = 0
                elif i == N-1:
                    if ices[i] >= L:
                        ices[i] = 0
                        break
                    if copied[i] > copied[N-2]:
                        ices[i] += 1
                        if ices[i] >= L:
                            ices[i] = 0
        copied = ices


        if ices.count(0) == N:
            print(counts)
            return
        counts += 1


N,L = map(int,input().strip().split())
ices = []
while True:
    ice = int(input().strip())
    ices.append(ice)
    if len(ices) == N:
        break

# N = 4
# L = 6
# ices = [4,2,3,5]

# N = 6
# L = 10
# ices = [3,4,1,9,5,1]

# with open("aoj.txt") as infile:
#     N,L = map(int,infile.readline().strip().split())
#     ices = []
#     while True:
#         ice = int(infile.readline())
#         ices.append(ice)
#         if len(ices) == N:
#             break

greedy(N,L,ices)

### FIXED CODE ###

def orderN(N,L,ices):
    upPeak = L - ices[0]
    downPeak = L - ices[0]
    peaks = []
    for i in range(len(ices)):
        if i < N-1:
            if ices[i] < ices[i+1]:
                peaks.append(downPeak)
                downPeak = L - ices[i+1]
                upPeak += L - ices[i+1]
            elif ices[i] > ices[i+1]:
                peaks.append(upPeak)
                upPeak = L - ices[i+1]
                downPeak += L - ices[i+1]
        elif i == N-1:
            peaks.append(upPeak)
            peaks.append(downPeak)
    print(max(peaks))

N,L = map(int,input().strip().split())
ices = [int(input().strip()) for _ in range(N)]


orderN(N,L,ices)
n,m=map(int,input().split())
road=[[] for _ in range(n+1)]
for i in range(m):
    a,b=map(int,input().split())
    road[a].append(b)
    road[b].append(a)
dp=[[0]*(n+1) for _ in range(2**n)]
dp[1][1]=1
for i in range(1,2**n):
    for j in range(1,n+1):
        for k in road[j]:
            
                dp[i+2**(k-1)][k]+=dp[i][j]
print(sum(dp[2**n-1]))



### FIXED CODE ###

n,m=map(int,input().split())
root=[[] for _ in range(n+1)]
for i in range(m):
    a,b=map(int,input().split())
    root[a].append(b)
    root[b].append(a)
s=[0]*(n+1)
s[0]=1
s[1]=1
ans=0
def f(a,x):
    global ans
    for i in root[a]:
        if x[i]==0:
            z=[x[j] for j in range(n+1)]
            z[i]=1
            f(i,z)
    if x.count(1)==n+1:
        ans+=1
f(1,s)
print(ans)
from scipy.special import comb


s = int(input())

if s < 3:
    print(0)
else:

    count = 0
    total = 0

    while True:
        s = s-3
        count += 1

        if s >= 0:
           total += comb(s+count-1, count-1)
        else:
            break

    print(int(total % (10**9+7)))


### FIXED CODE ###

from scipy.special import comb


s = int(input())

if s < 3:
    print(0)
else:

    count = 0
    total = 0

    while True:
        s = s-3
        count += 1

        if s >= 0:
           total += comb(s+count-1, count-1 ,exact=True)
           total = total% (10**9+7)
        else:
            break

    print(int(total ))
import sys, math
import io, os
#data = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
#from itertools import permutations,combinations
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var) : sys.stdout.write('\n'.join(map(str, var))+'\n')
def out(var) : sys.stdout.write(str(var)+'\n')
from decimal import Decimal
from fractions import Fraction
#sys.setrecursionlimit(100000)
INF = float('inf')
mod = int(1e9)+7


n,k=mdata()
p=mdata()
c=mdata()
ans=-INF
for i in range(n):
    c1=[]
    a=i
    while True:
        a=p[a]-1
        c1.append(c[a])
        if a==i:
            break
    m1=0
    for j in range(min(k,len(c1))):
        m1+=c1[j]
        ans=max(m1,ans)
    if m1>0:
        t=k//len(c1)
        m1=max(0,m1*(t-1))
        ind=max(0,len(c)*(t-1))
        ans=max(ans,m1)
        for i in range(ind,k):
            m1+=c1[i%len(c)]
            ans=max(ans,m1)
out(ans)



### FIXED CODE ###

import sys, math
import io, os
#data = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
#from itertools import permutations,combinations
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var) : sys.stdout.write('\n'.join(map(str, var))+'\n')
def out(var) : sys.stdout.write(str(var)+'\n')
from decimal import Decimal
from fractions import Fraction
#sys.setrecursionlimit(100000)
INF = float('inf')
mod = int(1e9)+7


n,k=mdata()
p=mdata()
c=mdata()
ans=-INF
for i in range(n):
    c1=[]
    a=i
    while True:
        a=p[a]-1
        c1.append(c[a])
        if a==i:
            break
    m1=0
    for j in range(min(k,len(c1))):
        m1+=c1[j]
        ans=max(m1,ans)
    if m1>0:
        t=k//len(c1)
        m1=max(0,m1*(t-1))
        ind=max(0,len(c1)*(t-1))
        ans=max(ans,m1)
        for i in range(ind,k):
            m1+=c1[i%len(c1)]
            ans=max(ans,m1)
out(ans)
n, x = map(int, input().split())

l = list(map(int, input().split()))

sum_ = 0
tmp = []
for i in range(n):
    sum_ += l[i]
    if sum_ > x:
        tmp.append(i)
    elif sum_ == x:
        tmp.append(i + 2)

print(max(tmp))

### FIXED CODE ###

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

l = list(map(int, input().split()))

tmp = 0
li = []
for i in range(n):
    tmp += l[i]
    if tmp <= x:
        li.append(i)
    if tmp >= x:
        break

print(max(li) + 2)
# if tmp == x:
#     print(max(li) + 2)
# elif tmp > x:
#     print(max(li) + 1)
n = int(input())
p = list(map(int,input().split()))
#n = 5
#p = [4,2,5,1,3]
maxcnt = 1
cnt = 1
for i in range(n):
    box = 0
    cnt = 1
    box = p[i]
    if n - i < maxcnt :
        break

    for j in range(i + 1 , n ):
        if i < j and box >= p[j]:
            box = p[j]
            cnt += 1
            if maxcnt < cnt :
                maxcnt = cnt
            
print(maxcnt)


### FIXED CODE ###

n, m = map(int,input().split())
if n == m :
    print('Yes')
else :
    print('No')
def base_k(n, k=26):
    ret = []
    ny = n
    while ny:

        ret.append(ny % k)
        ny //= k
    return ret[::-1]


def letter(i):
    return chr(i+97)


n = int(input())

check = 26
add = 26**2
cnt = 1
k = n
while True:
    if n <= check:
        break
    check += add
    cnt += 1
    add *= 26
k -= check//26 - 1

t = base_k(k-1)

ans = ""
if not t:
    ans = "a" * cnt
else:
    for i in range(len(t)-cnt, len(t)):
        ans += letter(t[i])

print(ans)

### FIXED CODE ###

def base_k(n, k=26):
    ret = []
    ny = n
    while ny:

        ret.append(ny % k)
        ny //= k
    return ret[::-1]


def letter(i):
    return chr(i+97)


def solve(n):
    check = 26
    cnt = 1
    k = n
    while True:
        if n <= check:
            break
        check *= 26
        check += 26
        cnt += 1
    k -= check//26 - 1
    t = base_k(k-1)
    ans = ""
    if not t:
        ans = "a" * cnt
    else:
        for _ in range(cnt):
            if not t:
                ans += "a"
                continue
            ans += letter(t.pop())

    return ans[::-1]


n = int(input())
print(solve(n))