Harryxun/stf_run huggingface dataset:
n=input();a=[];b="SHCD"
for i in range(4*13):a.append(b[i/13]+" "+str(i%13+1))
for i in range(n):c.remove(raw_input())
for i in c:print i

### FIXED CODE ###

j=input();i=52;a=[""]*i
while i:i-=1;a[i]="SHCD"[i/13]+" "+str(i%13+1)
while j:j-=1;a.remove(raw_input())
for i in a:print i
import math
while True:
    try:
        num = input().split(" ")
        num1 = int(num[0])
        num2 = int(num[1])
        sum_number =　num1 + num2
        ans = int(math.log10(sum_number) + 1)
        print(ans)

    except:
        break
    

### FIXED CODE ###

import math
while True:
    try:

        num1, num2 = map(int, input().split())
        sum_number = num1 + num2

        ans = int(math.log10(sum_number) + 1)
        print(ans)

    except:
        break
a, b  = map(int, input().split())

if a % 2 == 0 or b % 2 == 0:
  print('Even')
else:
  print('Odd)
  



### FIXED CODE ###

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

multiplication = a * b
if multiplication % 2 == 0:
  print('Even')
  
else:
  print('Odd')
N = int(input())
ans = 0
for m in range(N):
	if N//m == N%m:
		ans += 1

print(ans)

### FIXED CODE ###

import math
N = int(input())
ans = 0
n_max = int(math.sqrt(N))
for n in range(1,n_max+1):
	if N%n == 0:
		a = N//n
		if a+1 < n:
			ans += n-1
		elif n+1 < a:
			ans += a-1
print(ans)
s=input()
if s[-1]=='s':
  s+='es'
  return s
s+='s'
return s

### FIXED CODE ###

s=str(input())
if(s[-1]=="s"):
  	print(s+"es")
else:
	print(s+"s")
while True:
        a,op,b=map(str,input().split())
        a=float(a)
        b=float(b)
          
        if op=("+"):
                print(a+b)
        elif op=("-"):
                print(a-b)
        elif op=("*"):
                print(a*b)
        elif op=("/"):
                print(a/b)
        elif op=("?"):
                break



### FIXED CODE ###



while 1:
     s=input()
     if '?' in s: break
     print(int(eval(s)))
#!/usr/bin/env python3


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


MOD = 10**9 + 7


def dfs(colors, graph, parent, current):
    if colors < len(graph[current]):
        return 0

    num_avail_colors = colors - 1 if parent < 0 else colors - 2
    num_cases = 1
    neighbors = graph[current]
    for neighbor in neighbors:
        if neighbor == parent:
            continue

        num_cases *= num_avail_colors
        num_avail_colors -= 1
        num_cases %= MOD

    for neighbor in neighbors:
        if neighbor == parent:
            continue

        num_cases *= dfs(colors, graph, current, neighbor)
        num_cases %= MOD

    return num_cases


def main():
    N, K = read_h()
    graph = [[] for _ in range(N)]
    for _ in range(N - 1):
        a, b = read_h()
        graph[a - 1].append(b - 1)
        graph[b - 1].append(a - 1)

    ans = K * dfs(K, graph, -1, 0) % MOD
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10**7)


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


MOD = 10**9 + 7


def dfs(colors, graph, parent, current):
    if colors < len(graph[current]):
        return 0

    num_avail_colors = colors - 1 if parent < 0 else colors - 2
    num_cases = 1
    neighbors = graph[current]
    for neighbor in neighbors:
        if neighbor == parent:
            continue

        num_cases *= num_avail_colors
        num_avail_colors -= 1
        num_cases %= MOD

    for neighbor in neighbors:
        if neighbor == parent:
            continue

        num_cases *= dfs(colors, graph, current, neighbor)
        num_cases %= MOD

    return num_cases


def main():
    N, K = read_h()
    graph = [[] for _ in range(N)]
    for _ in range(N - 1):
        a, b = read_h()
        graph[a - 1].append(b - 1)
        graph[b - 1].append(a - 1)

    ans = K * dfs(K, graph, -1, 0) % MOD
    print(ans)


if __name__ == '__main__':
    main()
n = str(input())
l = []
for i in range(n):
  a = n[i]
  l.append(a)
sum_l = sum(l)
if int(n) % sum_l == 0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

N = input()
ans = 0
for i in N:
    ans += int(i)
if int(N)%ans == 0:
    print('Yes')
else:
    print('No')
N = int(input())

cnt_dict = {}

for i in range(N):
    s_list = list(input())
    s_str = "".join(s_list.sort())
    if s_str not in cnt_dict.keys():
        cnt_dict[s_str] = 1
        continue
    cnt_dict[s_str] += 1

import itertools
comb = itertools.combinations

total = 0
for key in cnt_dict.keys():
    cnt = cnt_dict[key]
    if cnt < 2:
        continue
    total += len(list(comb(range(cnt), 2)))

print(total)




### FIXED CODE ###


N = int(input())

cnt_dict = {}

for i in range(N):
    s_list = list(input())
    s_list.sort()
    s_str = "".join(s_list)
    if s_str not in cnt_dict.keys():
        cnt_dict[s_str] = 1
        continue
    cnt_dict[s_str] += 1

import itertools
comb = itertools.combinations

total = 0
for key in cnt_dict.keys():
    cnt = cnt_dict[key]
    if cnt < 2:
        continue
    total += cnt * (cnt - 1) // 2

print(total)
# -*- coding: utf-8 -*-
import sys

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

	ins = []
	for _ in range(n):
		t, a = map(int, input().split(" "))
		ins.append((t, a))

	takahashi = 0
	aoki = 0
	takahashi, aoki = ins[0]

	for i, val in enumerate(ins):
		if i == 0: continue
		t, a = val
		m = max(-(-takahashi // t), -(-aoki // a))
		takahashi, aoki = t * m, a * m

	print(takahashi + aoki)

if __name__ == "__main__":
	main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys

def main():
	a, b, c = map(int, input().split(" "))

	ans = 1
	if a != b:
		ans = ans + 1
	if a != c and b != c:
		ans = ans + 1

	print(ans)

if __name__ == "__main__":
	main()
a,b = int,input().split()
print(a*b)

### FIXED CODE ###

a, b = map(int, input().split())
print(a * b)
x,y,z=[int(i) for i in input().split()]
S=list(range(x,y+1))

if x<z:
    for j in range(0,z-x):
        print(S[j])
if z<y:
    for j in range(z-x+1,y-x+1):
        print(S[j])

### FIXED CODE ###

A, B, K = map(int, input().split())
l = []

for i in range(A, min(B, A+K)):
  l.append(i)
for i in range(max(A, B-K+1), B+1):
  l.append(i)

l = list(set(l))
l.sort()
for i in l:
  print(i)
from math import gcd

n, m = map(int, input().split())
s = input()
t = input()

if n % m != 0 and m % n != 0:
	print(n // gcd(n, m) * m)
elif n >= m:
	ok = True
	for i in range(m):
		if s[(n // m) * i] != t[i]:
			ok = False
			break
	if ok:
		print(n)
	else:
		print(-1)
else:
	ok = True
	for i in range(n):
		if t[(m // n) * i] != s[i]:
			ok = False
			break
	if ok:
		print(m)
	else:
		print(-1)


### FIXED CODE ###

from fractions import gcd

n, m = map(int, input().split())
s = input()
t = input()

g = gcd(n, m)
lcm = n // g * m
ok = True
for i in range(n):
	if (i * (lcm // n)) % (lcm // m) == 0:
		if s[i] != t[(i * (lcm // n)) // (lcm // m)]:
			ok = False
			break
if ok:
	print(lcm)
else:
	print(-1)
def solve(string):
    ins = string.split("\n")
    h, w = map(int, ins[0].split(" "))
    matrix = [list(map(int, _i.split(" "))) for _i in ins[1:]]
    move = []
    for _h in range(h):
        for _w in range(w):
            if matrix[_h][_w] % 2 == 0:
                continue
            matrix[_h][_w] -= 1
            if _w < w - 1:
                matrix[_h][_w + 1] += 1
                move.append("{} {} {} {}".format(_h + 1, _w + 1, _h + 1, _w + 2))
            elif _h < h - 1:
                matrix[_h + 1][_w] += 1
                move.append("{} {} {} {}".format(_h + 1, _w + 1, _h + 2, _w + 1))
    return "{}\n{}".format(len(move), "\n".join(move))


if __name__ == '__main__':
    line = input()
    tmp = [line]
    for _ in range(int(line[0])):
        tmp.append(input())
    print(solve('\n'.join(tmp)))


### FIXED CODE ###

h,w = map(int,input().split())
a = []
for i in range(h):
    tmp = list(map(lambda x:int(x)%2,input().split()))
    a.append(tmp)
result = []
 
for i in range(h):
    for j in range(w-1):
        if a[i][j] == 1:
            #a[i][j] == 0
            a[i][j+1] = 1 ^ a[i][j+1]
            result.append((i+1,j+1,i+1,j+2)) 
for i in range(h-1):
    if a[i][w-1] == 1:
        a[i+1][w-1] = 1 ^ a[i+1][w-1]
        result.append((i+1,w,i+2,w))
print(len(result))
for row in result:
    print("{} {} {} {}".format(row[0],row[1],row[2],row[3]))
K = int(input())
S = input()
x = len(s)

if x <= K:
  print(S)
else:
  print(S[K -1:])

### FIXED CODE ###

K = int(input())
S = input()
x = len(S)
 
if x <= K:
    print(S)
else:
    print(S[:K] + '...')
import numpy as np

n, m, l = map(int, input().split())

a = np.matrix(';'.join([input() for i in range(n)]))
b = np.matrix(';'.join([input() for i in range(m)]))
c = a * b

for i in range(n):
    print(' '.join(map(str, c.tolist()[i])))

### FIXED CODE ###

n, m, l = map(int, input().split())

a = [list(map(int, input().split())) for i in range(n)]
b = [list(map(int, input().split())) for i in range(m)]

c = [[0 for i in range(l)] for i in range(n)]
for i in range(n):
    for j in range(l):
        c[i][j] = sum([(a[i][x] * b[x][j]) for x in range(m)])

for i in range(n):
    print(' '.join(map(str, c[i])))
from collections import deque
import sys

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

mod = 10 ** 9 + 7
num = 0
Ans = 1

while num < K-1:
    non_minus = A[-1] * A[-2]
    minus = A[0] * A[1]
    if non_minus > minus:
        Ans = Ans * A.pop() % mod
        num += 1
    else:
        Ans = Ans * A.popleft() * A.popleft() % mod
        num += 2

if num == K - 1:
    Ans = Ans * A[-1] % mod
    
if A[-1] < 0 and K % 2 == 1:
    Ans = 1
    for i in range(K):
        Ans = Ans * A[i] % mod

print(Ans)
        

### FIXED CODE ###

mod = 10**9+7
N, K = map(int,input().split())
A = sorted(list(map(int,input().split())))

pi = 1
ni = 0
ans = 1
i = 0
while i < K-1:
  if A[ni]*A[ni+1] > A[-pi]*A[-pi-1]:
    ans = ans*A[ni]*A[ni+1]%mod
    ni += 2
    i += 2
    
  else:
    ans = ans*A[-pi]%mod
    pi += 1
    i += 1
    
if i == K-1:
  ans = ans*A[-pi]%mod
  
if A[-1]<0 and K%2==1:
  ans = 1
  for i in A[N-K:]:
    ans = ans*i%mod

print(ans)
def fill0(s,x,y):
	if 0 <= x <= W-1 and 0 <= y <= H-1 and A[y][x] == s:
		A[y][x] = 0
		fill0(s,x+1,y); fill0(s,x,y+1); fill0(s,x-1,y); fill0(s,x,y-1)
while 1:
	H,W = map(int,raw_input().split())
	if H == 0: break
	print 1

### FIXED CODE ###

import sys
sys.setrecursionlimit(20000)
def solve(h,w,count,c):
    if 0 <= h < H and 0 <= w < W and A[h][w] == c:
        A[h][w] = count
        for dh,dw in zip([1,0,-1,0],[0,1,0,-1]):
            solve(h+dh,w+dw,count,c)
while 1:
    H,W = map(int,raw_input().split())
    if H == W == 0: break
    A = [list(raw_input()) for _ in range(H)]
    count = 0
    for h in range(H):
        for w in range(W):
            if type(A[h][w]) is not int:
                solve(h,w,count,A[h][w])
                count += 1
    print count
usrInput = input()
print(int(usrinput) ** 2)

### FIXED CODE ###

usrInput = input()
print(int(usrInput) ** 2)
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    q = int(input())
    for _ in range(q):
        a, b = map(int, input().split())
        c = a * b - 1
        rc = int(c ** 0.5)
        ans = rc * 2 - 2
        if c // rc == rc:
            ans -= 1
        if a > rc:
            y = rc // a
            if y == 0:
                ans += 1
            else:
                x = rc // y
                if x != a or (c // a == c // (a - 1)):
                    ans += 1
        if b > rc:
            y = rc // b
            if y == 0:
                ans += 1
            else:
                x = rc // y
                if x != b or (c // b == c // (b - 1)):
                    ans += 1
        print(ans)

main()


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    def df(c, d):
        res = c // d
        if res * d > c: res -= 1
        return res

    q = int(input())
    L = [list(map(int, input().split())) for _ in range(q)]
    for a, b in L:
        if (a, b) == (1, 1):
            print(0)
            continue
        c = a * b - 1
        rc = int(c ** 0.5)
        rc -= 1
        while (rc + 1) ** 2 <= c:
            rc += 1
        ans = rc * 2
        if rc * (rc + 1) > c:
            ans -= 1
        ab = [a, b]
        for k in ab:
            ans -= 1
            if k > rc:
                y = df(c, k)
                if y == 0:
                    ans += 1
                else:
                    x = df(c, y)
                    if x != k or (df(c, k) == df(c, k - 1)):
                        ans += 1
        print(ans)

main()
def find_AC(S):
  ret = []
  for i in range(len(S)-1):
    if S[i] == 'A' and S[i+1] == 'C':
      ret.append(i)
  return ret

N, Q = [int(x) for x in input().split()]
S = input()
result = find_AC(S)
print(result)
pos = [res+1 for res in result]

for _ in range(Q):
  l, r = [int(x) for x in input().split()]
  ans = 0
  for p in pos:
    if p>=l and p<=r-1:
      ans += 1
  print(ans)


### FIXED CODE ###

N, M = [int(x) for x in input().split()]

AB = []

for _ in range(N):

    AB.append([int(x) for x in input().split()])

AB = sorted(AB, key=lambda x: x[0])

current_drinks = 0

current_buget = 0

for a, b in AB:

    num_buy = min(b, (M-current_drinks))

    current_drinks += num_buy

    current_buget += num_buy*a

    # print(current_drinks, current_buget)

    if current_drinks == M:

        break

print(current_buget)
S = input()
ans = "CODEFESTIVAL2016"
a = 0
for i in range(S):
  if S[i] != ans[i]:
    a += 1
print(a)

### FIXED CODE ###

S = input()
ans = "CODEFESTIVAL2016"
a = 0
for i in range(len(S)):
  if S[i] != ans[i]:
    a += 1
print(a)
string = input()
num = int(input())

count=1
out =string[0]

for i,s in zip([i for i in range(len(string))],string):
    if i != 0:
        if i%num == 0:
            out=out+string[i]
print(out)


### FIXED CODE ###

l = input().split()
if int(l[0])+int(l[1])==15:
    print('+')
elif int(l[0])*int(l[1]) ==15:
    print('*')
else:
    print('x')
n,k=map(int,input().split())
b=[0]*(n+1)
for i in range(n):
    b[i+1]=b[i]+int(input())-k
a=sorted(set(b))
s={a[i-1]:i for i in range(1,len(a)+1)}
c=[]
for i in b:
    c.append(s[i])
b=[0]*(n+1)
def f(x):
    c=0
    while x>0:
        c+=b[x]
        x-=x&-x
    return c
def g(x):
    while x<n+1:
        b[x]+=1
        x+=x&-x
e=0
for i in range(n+1):
    e+=f(c[i])
    g(c[i])
print(e)

### FIXED CODE ###

n,k=map(int,input().split())
b=[0]*(n+1)
for i in range(n):
    b[i+1]=b[i]+int(input())-k
a=sorted(set(b))
s={a[i-1]:i for i in range(1,len(a)+1)}
c=[]
for i in b:
    c.append(s[i])
b=[0]*(len(a)+1)
def f(x):
    c=0
    while x>0:
        c+=b[x]
        x-=x&-x
    return c
def g(x):
    while x<len(a)+1:
        b[x]+=1
        x+=x&-x
e=0
for i in range(n+1):
    e+=f(c[i])
    g(c[i])
print(e)
N = int(input())
kuku = []
for i in range(1, 10):
  kuku += [i * e for i in range(1, 10)]
if N in kuku:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N = int(input())
kuku = []
for i in range(1, 10):
  kuku += [i * j for j in range(1, 10)]
if N in kuku:
  print("Yes")
else:
  print("No")
def f(N):
    global table
    for x, y, z in combinations_with_replacement(range(1, 100), 3):
        n = x**2+y**2+z**2+x*y+y*z+z*x
        if n>N:
            continue
        if x==y==z:
            table[n] = 1
        elif x==y or y==z or z==x:
            table[n] = 3
        else:
            table[n] = 6
N = int(input())
table = [0 for _ in range(N+1)]
f(N)
for n in range(1, N+1):
    print(table[n])

### FIXED CODE ###

from itertools import combinations_with_replacement
def f(N):
    global table
    for x, y, z in combinations_with_replacement(range(1, 100), 3):
        n = x**2+y**2+z**2+x*y+y*z+z*x
        if n>N:
            continue
        if x==y==z:
            table[n] += 1
        elif x==y or y==z or z==x:
            table[n] += 3
        else:
            table[n] += 6
N = int(input())
table = [0 for _ in range(N+1)]
f(N)
for n in range(1, N+1):
    print(table[n])
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

X = [A, B, C, D, E]
Y = [[x, 10-x%10] for x in X]
acc = 0
for y in Y:
    if y[1] == 10:
        acc += y[0]
    else:
        acc += y[0] + y[1]
Z = [10-a%10 for a in X if (10-a%10) < 10]
acc -= max(Z)
print(acc)


### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

X = [A, B, C, D, E]
Y = [[x, 10-x%10] for x in X]
acc = 0
for y in Y:
    if y[1] == 10:
        acc += y[0]
    else:
        acc += y[0] + y[1]
Z = [10-a%10 for a in X if (10-a%10) < 10]
if Z:
    acc -= max(Z)
print(acc)
import math
A,B=input().split()
ans=int(A)*int(math.ceil(B))
print(math.floor(ans))

### FIXED CODE ###

import math
A,B=input().split()
A=int(A)
B=int(float(B)*1000)
ans=A*B
ans=str(ans)
if len(ans) < 4:
    print(0)
else:
    print(ans[:-3])
A,B,X = map(int, input().split())

#値段の算出する関数
def nedan(N,A,B):
    Nmozi = str(N)
    lengs = len(Nmozi)
    ans = A * N  + B * lengs
    return ans


#Nの値を二分法で計算する。
MAX = 1000000000
MIN = 0

for i in range(500):
    CENTER = MIN + (MAX-MIN)//2
    if MAX - MIN < 0.5:
        break
#MAXとMINが同じになったら終了する。
    if nedan(CENTER,A,B) <= X:
        MIN = CENTER
    else:
        MAX = CENTER



if nedan(MAX,A,B) <= X:
    ANS = MAX
else:
    ANS = MIN

print(ANS)

### FIXED CODE ###

S = input()

if S =="SUN":
    print(7)
elif S =="MON":
    print(6)
elif S =="TUE":
    print(5)
elif S =="WED":
    print(4)
elif S =="THU":
    print(3)
elif S =="FRI":
    print(2)
else:
    print(1)
n,a,b = map(int, input().split())

if n == 1 and a == b:
  print(1)
elif n == 1:
  print(0)
elif a > b:
  print(0)
elif n == 2:
  print(1)	
elif n > 2:
  print( (B-A+1) * (n-2) )
else:
  print(0)

### FIXED CODE ###

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

if n == 1 and a == b:
  print(1)
elif n == 1:
  print(0)
elif a > b:
  print(0)
elif n == 2:
  print(1)	
elif n > 2:
  print( b * (n-2) - a * (n-2) + 1) 
else:
  print(0)
def Haiku(check,syllables):
    check.sort()
    syllables.sort()
    if check==syllables:
        return "YES"
    else:
        return "NO"
      
print(Haiku(check,syllables))

### FIXED CODE ###

syllables=[5,5,7]
check=list(map(int,input().split()))
check.sort()
syllables.sort()
if check==syllables:
    print("YES")
else:
    print("NO")
import sys
import numpy as np
n,k = [int(x) for x in sys.stdin.readline().split()]
r = np.array()
for i in range(n):
	r[i] = [int(x) for x in sys.stdin.readline().split()]
r.sort(key=lambda x:x[0])
c = 0
for i,j in enumerate(r):
	c += j[0]
	if c >= k:
		print(j[1])
		break

### FIXED CODE ###

import sys
import numpy as np
import collections
n,k = [int(x) for x in sys.stdin.readline().split()]
r = collections.defaultdict(int)
for i in range(n):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a] += b
d = sorted(r.items())
c = 0
for i,j in enumerate(d):
	c += j[1]
	if c >= k:
		print(int(j[0]))
		break
X,Y=(int(i) for i in input().split())
left=ord(X)-55
right=ord(Y)-55
if left==right:
  print("=")
elif left>right:
  print(">")
else:
  print("<")

### FIXED CODE ###

X,Y=(i for i in input().split())
left=ord(X)-55
right=ord(Y)-55
if left==right:
    print("=")
elif left>right:
    print(">")
else:
    print("<")
S = input()
if len(S) != 6:
    print('No')
    return

if S[2]==S[3] and S[4]==S[5]:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

S = input()

if S[2]==S[3] and S[4]==S[5] and len(S)==6 :
    print('Yes')
else:
    print('No')
import numpy as np

N = int(raw_input())
A = [0] * N
for idx in xrange(N):
  A[idx] = int(raw_input())
total =  0
pre = 0
for item in A:
  total += (item+pre) / 2
  if item == 0:
    pre = 0
  else:
    pre = (item+pre) % 2

print total

### FIXED CODE ###

S = raw_input()
S = list(S)
S = set(S)
flagSN = False
flagEW = False
if ('N' in S and 'S' in S) or ('N' not in S and 'S' not in S):
  flagSN = True
if ('W' in S and 'E' in S) or ('W' not in S and 'E' not in S):
  flagEW = True
if flagSN and flagEW:
  print 'Yes'
else:
  print 'No'
n,k = map(int,input().split())

print(-(-(n-1) // (k-1)))

### FIXED CODE ###

s = list(input())
ans = 0
for i in s:
    if i == '+':
        ans += 1
    else:
        ans -= 1
print(ans)
z,b,c=map(int,input().split())
print(c-max((a-b),c))

### FIXED CODE ###

a,b,c=map(int,input().split())
print(c-min(a-b,c))
s=input()
q=int(input())
i=0
for _ in range(q):
    a=list(input().split())
    if a[0]=="1":
        i+=1
    else:
        if a[1]=="1" and i%2==1:
            z=z+a[3]
        elif a[1]=="1" and i%2==0:     
            x=a[2]+x
        elif a[1]=="2" and i%2==1:  
            x=x+a[3]
        else:
            z=z+a[3]
print(z[::-1]+s[::-1]+x[::-1] if i%2 else x+s+z)

### FIXED CODE ###

s=input()
q=int(input())
i=0
x=z=""
for _ in range(q):
    a=list(input().split())
    if a[0]=="1":
        i+=1
    else:
        if a[1]=="1" and i%2==1:
            z=z+a[2]
        elif a[1]=="1" and i%2==0:     
            x=a[2]+x
        elif a[1]=="2" and i%2==1:  
            x=a[2]+x
        else:
            z=z+a[2]
print(z[::-1]+s[::-1]+x[::-1] if i%2 else x+s+z)
import sys
n=int(input())
a=list(map(int,input().split()))
j=0
cnt=0
if n==1:
    sys.exit("Yes")
for i in range(1,n):
    if 0<=a[i]-a[j]:
        j=i
    else:
        a[j]=a[j-1]
        cnt+=1
        j=i
        if cnt==2:
            break
        else:
            continue
        
if cnt<=1:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
v = -1
for h in H:
    if v > h:
        if v != h+1:
            print("No")
            exit()
        else:
            v = h+1
    else:
        v = h
print("Yes")
import fractions

input()
A=set([int(i) for i in input().split()])

ans=1
if len(A)==1:
    print(10**9)
elif len(A)==2:
    ans=max(A)
else:  
    for a in A:
        A2=A-{a}
        print(A)
        ans=max(ans,fractions.gcd(*A2))

print(ans)

### FIXED CODE ###

import sys

sys.setrecursionlimit(1000000)

import fractions
from functools import reduce

N=int(input())
A=[int(i) for i in input().split()]

def mygcd(a,b):
    if a==0:
        return b
    elif b==0:
        return a
    else:
        return fractions.gcd(a,b)

L=[0]*N
for i in range(1,N):
    L[i]=mygcd(L[i-1],A[i-1])

R=[0]*N
for i in range(N-2,-1,-1):
    R[i]=mygcd(R[i+1],A[i+1])

ans=1
for i in range(N):
    c=mygcd(L[i],R[i])
    ans=max(ans,c)

print(ans)