Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import copy
import numpy as np
def main():
    line = input().split(' ')
    N, M = int(line[0]), int(line[1])
    root = np.asarray([list(map(int, input().split(' '))) for i in range(M)])
    #signpost = [0 for i in range(N+1)]
    signpost = np.zeros(N+1)

    mem1 = [1]
    for i in range(M):
        mem2 = []
        for node in root:
            if node[0] in mem1:
                if signpost[node[1]] == 0 and node[1] != 1:
                    signpost[node[1]] = node[0]
                    mem2.append(node[1])
            elif node[1] in mem1:
                if signpost[node[0]] == 0 and node[0] != 1:
                    signpost[node[0]] = node[1]
                    mem2.append(node[0])
        if len(mem2) == 0:
            break
        mem1.clear()
        #list(set(mem2))
        mem1 = copy.copy(mem2)

    if 0 in signpost[2:]:
        print('No')
    else:
        print('Yes')
        for i in signpost[2:]:
            print('{:.1g}'.format(i))        

if __name__ == "__main__":
    main()


### FIXED CODE ###

from collections import deque

def main():
    N, M = map(int, input().split(' '))
    edge = [[] for i in range(N+1)]
    for _ in range(M):
        a, b = map(int, input().split(' '))
        edge[a].append(b)
        edge[b].append(a)
    signpost = [None] * (N+1)
    signpost[0] = signpost[1] = 0
    q = deque([1])
    dist = [0 for i in range(N+1)]
    while q:
        node = q.popleft()
        for e in edge[node]:
            if signpost[e] is None:
                dist[e] = dist[node] + 1
                signpost[e] = node
                q.append(e)
    if 0 in signpost[2:]:
        print('No')
    else:
        print('Yes')
        for i in signpost[2:]:
            print(i)        

if __name__ == "__main__":
    main()
### BUGGY CODE ###

# ===================================
# (c) MidAndFeed aka ASilentVoice
# ===================================
# import math, fractions, collections
# ===================================
x, y = [int(x) for x in input().split()]
if x == y:
	print(-1)
else:
	temp = x
	while(temp%y == 0):
		temp += x
	print(temp)

### FIXED CODE ###

# ===================================
# (c) MidAndFeed aka ASilentVoice
# ===================================
# import math, fractions, collections
# ===================================
x, y = [int(x) for x in input().split()]
if x == y or y == 1 or x%y == 0:
	print(-1)
else:
	temp = x
	while(temp%y == 0):
		temp += x
	print(temp)
### BUGGY CODE ###

#--初期の並びを圧縮表示,逆立ち、正立を目印--#
import sys,math,collections,itertools
input = sys.stdin.readline

N,K = list(map(int,input().split()))
S = input().rstrip()

stand = []
s_or_r = []

s_bf = '.'
cnt = 0
for i in range(N):
    if s_bf != S[i] and i != 0:
        stand.append(cnt)
        s_or_r.append(s_bf)
        cnt = 1
        s_bf=S[i]
    else:
        cnt += 1
        s_bf =S[i]
stand.append(cnt)
s_or_r.append(s_bf)


#--正立kまで許容して足す。maxが答え
if s_or_r.count('0')<=K:
    print(len(S))
    exit()

ans = 0
for start in range(len(stand)):
    rev = 0
    tmp = 0
    i=0
    flag = 0
    while rev+(s_or_r[start+i] == '0')<=K:
        tmp += stand[start+i]
        if s_or_r[start+i] == '0':
            rev += 1
        if start + i == len(stand)-1:
            flag =1
            break
        i += 1
    ans = max(ans,tmp)
    if flag == 1:
        break
print(ans)


### FIXED CODE ###

#--初期の並びを圧縮表示,逆立ち、正立を目印--#
import sys,math,collections,itertools
input = sys.stdin.readline

N,K = list(map(int,input().split()))
S = input().rstrip()

stand = []
s_or_r = []

s_bf = '.'
cnt = 0
for i in range(N):
    if s_bf != S[i] and i != 0:
        stand.append(cnt)
        s_or_r.append(s_bf)
        cnt = 1
        s_bf=S[i]
    else:
        cnt += 1
        s_bf =S[i]
stand.append(cnt)
s_or_r.append(s_bf)


#--正立kまで許容して足す。maxが答え
if s_or_r.count('0')<=K:
    print(len(S))
    exit()
#--成形==#
if s_or_r[0]=='0':
    s_or_r=['1']+s_or_r
    stand = [0]+stand
if s_or_r[-1]=='0':
    s_or_r.append('1')
    stand.append(0)
#初期条件#
tmp = sum(stand[0:2*K+1])
ans = tmp
for i in range(2,len(stand)-2*K,2):
    tmp += -(stand[i-1]+stand[i-2])+stand[i+2*K-1]+stand[i+2*K]
    ans = max(ans,tmp)
print(ans)
### BUGGY CODE ###


def main():
    n,k=map(int,input().split())
    h=list(map(int,input().split()))
    dp=[None]*n
    temp=[1001]*n
    dp[0]=0
    dp[1]=abs(h[1]-h[0])
    for i in range(2,n):
        low=i-k-1
        if low<0:
            low=-1
        for j in range(i-1,low,-1):
            temp[j]=dp[j]+abs(h[i]-h[j])
            if j==i-1:
                mn=temp[j]
            else:
                if mn > temp[j]:
                    mn=temp[j]
        # temp2=dp[i-2]+abs(h[i]-h[i-2])
        # temp1=dp[i-1]+abs(h[i]-h[i-1])
        dp[i]=mn
        temp=[1001]*n
    print(dp[n-1])

if __name__=='__main__':
    main()


### FIXED CODE ###


def main():
    n,k=map(int,input().split())
    h=list(map(int,input().split()))
    dp=[None]*n
    temp=[1001]*n
    dp[0]=0
    dp[1]=abs(h[1]-h[0])
    for i in range(2,n):
        low=i-k-1
        if low<0:
            low=-1
        for j in range(i-1,low,-1):
            temp[j]=dp[j]+abs(h[i]-h[j])
            if j==i-1:
                mn=temp[j]
            else:
                if mn > temp[j]:
                    mn=temp[j]
        # temp2=dp[i-2]+abs(h[i]-h[i-2])
        # temp1=dp[i-1]+abs(h[i]-h[i-1])
        dp[i]=mn
        #temp=[1001]*n
    print(dp[n-1])

if __name__=='__main__':
    main()
### BUGGY CODE ###

import numpy as np
from fractions import gcd

MOD = 10**9+7


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

    x = 1
    ans = 0
    for a in A:
        tmp = gcd(x, a)
        # ans += (i) * A[i] // tmp + A[i] * x //tmp  
        x = (x * a) // tmp
    
    b = 0
    A = np.array(A)
    # for a in A:
    #     b += x // a
    b = np.sum(x//A, axis=0)
    print(b%MOD)
main()


### FIXED CODE ###

import fractions 
#from functools import reduce
import functools

MOD = 10**9+7


def main():
    # N = int(input())
    # A = list(map(int, input().split()))
    N, *A = map(int, open(0).read().split())
            
    x = 1
    for a in A:
        x *= a //  fractions.gcd(x, a)
        
    b = sum(x//a for a in A)
    print(b%MOD)
    
if __name__== "__main__":
    main()
### BUGGY CODE ###

from itertools import groupby, accumulate, product, permutations, combinations
def solve():
  N, K = map(int, input().split())
  L = list(map(int, input().split()))
  ans = 0
  for com in combinations(L,K):
    cnt = 0
    for c in com:
      cnt += c
    ans = max(ans,cnt)
  return ans
print(solve())

### FIXED CODE ###

from itertools import groupby, accumulate, product, permutations, combinations
def solve():
  N, K = map(int, input().split())
  L = list(map(int, input().split()))
  L.sort(reverse=True)
  ans = sum(L[:K])
  return ans
print(solve())
### BUGGY CODE ###

S = input()
Q = int(input())
query = [None]*Q
for i in range(Q):
    query[i] = input()

rev = 0
for q in query:
    if q[0] == "1":
        rev = (rev+1)%2
    else:
        if q[2] == "1":
            if rev == 0:
                S = q[4] + S
            else:
                S = S + q[4]
        else:
            if rev ==0:
                S = S + q[4]
            else:
                S = q[4] + S
if rev == 1:
    S = S[::-1]

print(S)

### FIXED CODE ###

from sys import stdin

def main():
    S = list(stdin.readline().rstrip())
    Q = int(input())
    rev = 0
    head = []
    tail = []

    for _ in range(Q):
        q = stdin.readline()
        if q[0] == "1":
            rev = (rev+1)%2
        else:
            if q[2] == "1":
                if rev == 0:
                    head.append(q[4])
                else:
                    tail.append(q[4])
            else:
                if rev ==0:
                    tail.append(q[4])
                else:
                    head.append(q[4])

    if rev == 0:
        ans = "".join(head[::-1] + S + tail)
    else:
        ans = "".join(tail[::-1] + S[::-1] + head)
    
    print(ans)
    """
    S = stdin.readline().rstrip() 
    Q = int(input())
    rev = 0
    for _ in range(Q):
        q = stdin.readline()

        if q[0] == "1":
            rev = (rev+1)%2
        else:
            if q[2] == "1":
                if rev == 0:
                    S = "{}{}".format(q[4], S)
                else:
                    S = "{}{}".format(S, q[4])
            else:
                if rev ==0:
                    S = "{}{}".format(S, q[4])
                else:
                    S = "{}{}".format(q[4], S)
    if rev == 1:
        print(S[::-1])
    else:
        print(S)
    """
main()
### BUGGY CODE ###

from collections import deque

n=int(input())
a_num = ord("a")
deque = deque()
deque.append(("a", a_num))
ans = []

while len(deque) > 0:
    s, s_num = deque.popleft()
    for i in range(a_num, s_num + 2):
        s_nxt = s + chr(i)
        s_num = max(s_num, i)
        if len(s_nxt) == n:
            ans.append(s_nxt)
        else:
            deque.appendleft((s_nxt, s_num))

ans.sort()
for a in ans:
    print(a)

### FIXED CODE ###

from collections import deque

n=int(input())
a_num = ord("a")
deque = deque()
deque.append(("a", a_num))
ans = []

if n > 1:
    while len(deque) > 0:
        s, s_num = deque.popleft()
        for i in range(a_num, s_num + 2):
            s_nxt = s + chr(i)
            s_num = max(s_num, i)
            if len(s_nxt) == n:
                ans.append(s_nxt)
            else:
                deque.appendleft((s_nxt, s_num))

    ans.sort()
    print(" ".join(ans))

else:
    print("a")
### BUGGY CODE ###

from collections import Counter
s = input()
n = len(s)
# 累積和の準備
sum_list = [0]*(n+1)  # s[0]は０であってほしいから配列数ひとつおおい
for i in range(1, n + 1):
    sum_list[i] += (sum_list[i-1] + int(s[n-i])*10**(i-1)) % 2019  # ここでmodしておく
"""
(s[j]-s[i]/10**i)が区間の整数
区間の整数が2019で割り切れればよい
つまり、(s[j]-s[i]/10**i)≡0 (mod=2019)
ここで10**iと2019(素数)は互いに素なので、
10**iをかけて上の式はs[j]-s[i]≡0 (mod=2019)と同値
s[j]≡s[i] (mod=2019)となる。
"""
c = Counter(sum_list)
ans = 0

for key in c.keys():
    ans += c[key]*(c[key]-1)//2
print(ans)


### FIXED CODE ###

from collections import Counter
s = input()
n = len(s)
# 累積和の準備
sum_list = [0]*(n+1)  # s[0]は０であってほしいから配列数ひとつおおい
_10 = 1
for i in range(1, n + 1):
    sum_list[i] += (sum_list[i-1] + int(s[n-i])*_10 % 2019) % 2019  # ここでmodしておく
    _10 = _10*10 %2019
"""
(s[j]-s[i]/10**i)が区間の整数
区間の整数が2019で割り切れればよい
つまり、(s[j]-s[i]/10**i)≡0 (mod=2019)
ここで10**iと2019(素数)は互いに素なので、
10**iをかけて上の式はs[j]-s[i]≡0 (mod=2019)と同値
s[j]≡s[i] (mod=2019)となる。
"""
c = Counter(sum_list)
ans = 0

for key in c.keys():
    ans += c[key]*(c[key]-1)//2
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python3
#ABC119 D

import sys
import math
import bisect
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
mod = 10**9 + 7


a,b,q = map(int,input().split())
s = [-float('inf')] + [int(input()) for _ in range(a)] + [float('inf')]
t = [-float('inf')] + [int(input()) for _ in range(b)] + [float('inf')]

for _ in range(q):
    x = int(input())
    sr,tr = bisect.bisect_right(s,x),bisect.bisect_right(t,x)
    ans = float('inf')
    for S in [s[sr-1],s[sr]]:
        for T in [t[tr-1],t[tr]]:
            d1,d2 = abs(S-x) + abs(T-S), abs(T-x) + abs(S-T)
            ans = min(ans,d1,d2)
    print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
#ABC119 D

import sys
import math
import bisect
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
mod = 10**9 + 7


a,b,q = map(int,input().split())
s = [-float('inf')] + [int(input()) for _ in range(a)] + [float('inf')]
t = [-float('inf')] + [int(input()) for _ in range(b)] + [float('inf')]

for _ in range(q):
    x = int(input())
    sr,tr = bisect.bisect_right(s,x),bisect.bisect_right(t,x)
    ans = float('inf')
    for S in [s[sr-1],s[sr]]:
        for T in [t[tr-1],t[tr]]:
            d1,d2 = abs(S-x) + abs(T-S), abs(T-x) + abs(S-T)
            ans = min(ans,d1,d2)
    print(ans)
### BUGGY CODE ###

def main():
    N=int(input())
    S=input()
    ans=0
    for i in range(N-2):
        for j in range(i+1,N-1):
            lis=["R","G","B"]
            if S[i]!=S[j]:
                lis=["R","G","B"]
                lis.remove(S[i])
                lis.remove(S[j])
                k=S[j+1:].count(lis[0])
                ans=ans+k
            if j+(j-i)<N and S[i]!=S[j]:
                if S[j+(j-i)]!=S[i] and S[j+(j-i)]!=S[j]:
                    ans-=1
    print(ans)

main()

### FIXED CODE ###

def main():
    N=int(input())
    S=input()
    k1=S.count("R")
    k2=S.count("B")
    ans=k1*k2*(len(S)-k1-k2)
    for i in range(N-2):
        for j in range(i+1,N-1):
            if j+(j-i)<N and S[i]!=S[j]:
                if S[j+(j-i)]!=S[i] and S[j+(j-i)]!=S[j]:
                    ans-=1
    print(ans)
main()
### BUGGY CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
cnt_list = []
b = set(a)
for s in b:
    cnt_list.append(a.count(s))
cnt_list = sorted(cnt_list)

print(sum(cnt_list[:len(cnt_list) - k]) if len(cnt_list) - k > 0 else 0)

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
cnt_list = [0]*(n+1)
for i in range(n):
    cnt_list[a[i]] += 1
cnt_list.sort()
print(sum(cnt_list[:len(cnt_list) - k]))
### BUGGY CODE ###

from inspect import currentframe

def chkprint(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

def main():
    N, M, V, P = map(int, input().split())
    A = list(map(int, input().split()))
    dic_A = {k:v for (k, v) in enumerate(A)}
    sorted_dic_A = sorted(dic_A.items(), key=lambda x: x[1], reverse=True)
    # chkprint(sorted_dic_A)

    B = sorted_dic_A[:P]
    P_min_val = min(B, key=lambda  x: x[1])[1]
    # chkprint(B)
    C = sorted_dic_A[P:]
    # chkprint(C)

    ans = set()

    num_vote = M * V
    # chkprint(num_vote)
    for i, v in C:
        if P_min_val > v + M:
            break
        margin = num_vote
        margin -= M * (P-1)
        margin_list = [v+M-w for (j,w) in C if j!=i]
        mod_margin_list = list(map(lambda x: x if x < M else M, margin_list))
        # chkprint(margin_list)
        # chkprint(mod_margin_list)
        margin -= M
        margin -= sum(mod_margin_list)
        # chkprint(margin)
        if margin <= 0:
            ans.add(i)

    for i, _ in B:
        ans.add(i)

    print(len(ans))


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N, M, V, P = map(int, input().split())
    A = list(map(int, input().split()))
    sorted_A = sorted(A, reverse=True)

    def is_possible(i):
        # Aは降順 -> sorted_A、
        # i+1番目以降の問題のスコアをi番目の問題のスコア以下になるように投票すれば
        # i番目の問題に採用される可能性が生まれるという考え方

        # 投票前の上位P問は採用される可能性がある
        if i < P:
            return True

        # 残り投票数
        num_votes = V * M

        # i番目の問題を採用させようとする場合は、M人のジャッジ全員がi番目の問題に投票すればよい
        score_i = sorted_A[i] + M
        num_votes -= M

        # M人のジャッジ全員がi番目の問題に投票しても、上位P問にスコアが上がらない場合は採用される可能性がない
        if sorted_A[P - 1] > score_i:
            return False

        # 上の操作からi+1番目以降のの問題のスコアを、i番目の問題のスコアを超えることがないため、
        # M人のジャッジ全員がi+1番目以降の問題に投票してもよい
        num_votes -= (N - i - 1) * M

        # i番目の問題が上位P問に入ればよいので、P-1位の問題にもM人のジャッジ全員が投票してもよい
        num_votes -= (P - 1) * M

        # P番目からi番目
        # print('margin: {}, num_votes: {}'.format(sum(score_i - j for j in sorted_A[P-1 : i]), num_votes))
        return sum(score_i - j for j in sorted_A[P-1 : i]) >= num_votes

    # 1番目は必ず採用される
    # N番目は採用されるか
    if is_possible(N-1):
        print(N)

    # 1番目:採用、N番目:採用されない
    # -> [1:N-1]のどこに採用の境界があるかを二分探索する
    else:
        low = 0
        hight = N - 1

        while hight - low > 1:
            middle = (hight + low) // 2
            # print('PRE - low:{}, middle:{}, hight:{}'.format(low, middle, hight))
            if is_possible(middle):
                low = middle
            else:
                hight = middle
            # print('AFT - low:{}, middle:{}, hight:{}'.format(low, middle, hight))

        print(low + 1)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]
a.insert(0,-1)
ans = 0

tmp = 1
while 1:
    current = a[tmp]
    ans += 1
    if tmp == current or current == 1:
        print(a[0])
        exit()
    elif current == 2:
        print(ans)
        exit()
    else:
        tmp = current

### FIXED CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]
a.insert(0,-1)
ans = 0

tmp = 1
for i in range(1,n+1):
    current = a[tmp]
    ans += 1
    if current == 2:
        print(ans)
        exit()
    else:
        tmp = current

print(a[0])
### BUGGY CODE ###

n,q=map(int,input().split())
s=str(input())
s=list(s)
a=[0]*n
for i in range(0,n):
  temp=s[i:]  
  temp="".join(temp)
  a[i]=temp.count("AC")
for i in range(0,q):
  l,r=map(int,input().split())
  print(a[l-1]-a[r-1])

### FIXED CODE ###

n,q=map(int,input().split())
s=str(input())
a=[0]*n
s=list(s)
for i in range(1,n):
  temp=0
  if s[i]=="C" and s[i-1]=="A":
    temp=1
  a[i]=a[i-1]+temp
for i in range(0,q):
  l,r=map(int,input().split())
  print(a[r-1]-a[l-1])
### BUGGY CODE ###

N = int(input())
list_A = []

for _ in range(N):
    A = int(input())
    list_A.append(A)
    
A = max(list_A)
index_A = list_A.index(A)

for i in range(N):
    if list_A[i] == A:
        list_A[i] = 0
        print(max(list_A))
        list_A[i] = A
    else:
        print(A)

### FIXED CODE ###

N = int(input())
list_A = []

for _ in range(N):
    A = int(input())
    list_A.append(A)
    
A = max(list_A)
index_A = list_A.index(A)

list_B = sorted(list_A, reverse=True)
B = list_B[1]

for i in range(N):    
    if list_A[i] == A:
        print(B)
    else:
        print(A)
### BUGGY CODE ###

import bisect
N,M,Q=map(int,input().split())
L=[]
for i in range(M):
  a,b=map(int,input().split())
  L.append([a,b])
L.sort(key=lambda x:x[0])
for i in range(Q):
  x,y=map(int,input().split())
  j=bisect.bisect(L,[x,0])
  ans=0
  for k in range(j,M):
    if L[k][1]<=y:
      ans+=1
  print(ans)

### FIXED CODE ###

N,M,Q=map(int,input().split())
c=[[0 for i in range(N+1)] for j in range(N+1)]
for i in range(M):
  a,b=map(int,input().split())
  c[a][b]+=1
for i in range(1,N):
  for j in range(1,N+1-i):
    c[j][i+j]+=c[j+1][i+j]+c[j][i+j-1]-c[j+1][i+j-1]
for i in range(Q):
  a,b=map(int,input().split())
  print(c[a][b])
### BUGGY CODE ###

def main():
    import sys
    input = sys.stdin.buffer.readline
    #n = int(input())
    #l = list(map(int, input().split()))
    '''
    A=[]
    B=[]
    for i in range():
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)'''

    n,m = map(int, input().split())
    r=[[0 for i in range(n)]for i in range(n)]
    start = [0, 0]
    #print(bfs(h, w, m, start))
    for i in range(m):
        a,b=map(int, input().split())
        r[a-1][b-1]=b-1
        r[b-1][a-1]=a-1
    #print(r)
    
    from collections import deque
    d = [0 for i in range(n)]
    visited=[False for i in range(n)]
    flg = True
    queue=deque([0])
    dd=0
    while queue:
        now=queue.popleft()
        visited[now]=True
        #print(now)
        for i in r[now]:
            if visited[i]:
                continue
            else:
                queue.append(i)
                visited[i]=True
                d[i]=now
    #print(d)
    if flg:
        print("Yes")
        for i in range(1,n):
            print(d[i]+1)
    else:
        print("No")


if __name__ == "__main__":
     main()


### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.buffer.readline
    #n = int(input())
    #l = list(map(int, input().split()))
    '''
    A=[]
    B=[]
    for i in range():
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)'''

    n,m = map(int, input().split())
    r=[[]for i in range(n)]
    start = [0, 0]
    #print(bfs(h, w, m, start))
    for i in range(m):
        a,b=map(int, input().split())
        r[a-1].append(b-1)
        r[b-1].append(a-1)
    #print(r)
    
    from collections import deque
    d = [0 for i in range(n)]
    visited=[False for i in range(n)]
    flg = True
    queue=deque([0])
    dd=0
    while queue:
        now=queue.popleft()
        visited[now]=True
        #print(now)
        for i in r[now]:
            if visited[i]:
                continue
            queue.append(i)
            visited[i]=True
            d[i]=now

    print("Yes")
    for i in range(1,n):
        print(d[i]+1)


if __name__ == "__main__":
     main()
### BUGGY CODE ###

N=int(input())
list=[]
for t in range(1,N+1):
  if N%t==0:
    list+=[(t,int(N/t))]
mini=N+1
for (p,q) in list:
  if p+q<mini:
    mini=p+q
print(mini-2)

### FIXED CODE ###

N=int(input())
list=[]
for t in range(1,int(N**(1/2)+2)):
  if N%t==0:
    list+=[(t,int(N/t))]
mini=N+1
for (p,q) in list:
  if p+q<mini:
    mini=p+q
print(mini-2)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

N = int(input())
print(0, flush=True)
prev = input()
if prev == 'Vacant':
    exit()
left = 0
right = N

while right - left > 1:
    mid = (left + right) // 2
    print(mid, flush=True)
    s = input()
    if s == 'Vacant':
        exit()
    if prev == s:
        if (mid - left) % 2 == 0:
            left = mid
        else:
            right = mid
    else:
        if (mid - left) % 2 == 1:
            left = mid
        else:
            right = mid
        prev = s


### FIXED CODE ###

import sys
input = sys.stdin.readline

N = int(input())
left = 0
right = N
print(left, flush=True)
left_seat = input()
if left_seat == 'Vacant':
    exit()


while right - left > 1:
    mid = (left + right) // 2
    print(mid, flush=True)
    mid_seat = input()
    if mid_seat == 'Vacant':
        exit()
    if mid_seat == left_seat:
        if (mid - left) % 2 == 0:
            left = mid
        else:
            right = mid
    else:
        if (mid - left) % 2 == 1:
            left = mid
            left_seat = mid_seat
        else:
            right = mid
### BUGGY CODE ###

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

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

mindis=0

for i in range(len(a)):
  cw=0
  ncw=a[i]
  nccw=a[i]
  ccw=0

  for j in range(1,len(a)):
    r=0
    q=0

    if ncw>a[(i+j)%len(a)]:
      cw+=((k-ncw)+a[(i+j)%len(a)])
      r=-1
    if nccw<a[i-j]:
      ccw+=(nccw+(k-a[i-j]))
      q=-1
    if r==0:
      cw+=abs(ncw-a[(i+j)%len(a)])
    if q==0:
      ccw+=abs(nccw-a[i-j])

    ncw=a[(i+j)%len(a)]
    nccw=a[i-j]
    #print(cw,ccw)

  if mindis==0:
    if cw<ccw:
      mindis=cw
    else:
      mindis=ccw

  if mindis>cw:
    mindis=cw

  if mindis>ccw:
    mindis=ccw
  #print()

print(mindis)

### FIXED CODE ###

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

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

mindis=0

for i in range(len(a)):
  cw=0 #時計回り
  ccw=0#反時計

  if i==0:
    cw=a[len(a)-1]-a[0]
    ccw=k-(a[i+1]-a[i])

  elif i==len(a)-1:
    cw=k-(a[i]-a[i-1])
    ccw=a[i]-a[0]


  else:
    cw=k-(a[i+1]-a[i])
    ccw=k-(a[i]-a[i-1])

  #print(cw,ccw)

  if mindis==0:
    if ccw>cw:
      mindis=cw
    else:
      mindis=ccw

  if mindis>cw:
    mindis=cw
  if mindis>ccw:
    mindis=ccw

print(mindis)
### BUGGY CODE ###

N = int(input())
an = list(map(int, input().split()))
sum = 0
for k in range(len(an) - 1):
    i = k
    for i in range(len(an) - k - 1):
        sum += (an[k] * an[k + i + 1])
        sum %= (10 ** 9 + 7)
print(sum)

### FIXED CODE ###

p = (10 ** 9 + 7) * 2
N = int(input())
A = [int(x) for x in input().split()]
A2 = [(x ** 2) % p for x in A]
result = (((sum(A) % p) ** 2 - sum(A2) % p) % p) / 2
print(int(result))