Harryxun/stf_run huggingface dataset:
N, M = map(int, stdin.readline().rstrip().split())
AC = 0
WA = 0
data = {}
for _ in range(M):
    tmp = stdin.readline().rstrip().split()
    p, S =  int(tmp[0]), tmp[1]
    if p not in data.keys():
        if S == 'AC':
            data[p] = {'AC': True, 'WA': 0}
            AC += 1
        elif S == 'WA':
            data[p] = {'AC': False, 'WA': 1}
    else:
        if S == 'AC':
            if data[p]['AC'] is True:
                continue
            elif data[p]['AC'] is False:
                data[p]['AC'] = True
                WA += data[p]['WA']
                AC += 1
        elif S == 'WA':
            if data[p]['AC'] is True:
                continue
            elif data[p]['AC'] is False:
                data[p]['WA'] += 1
print('{} {}'.format(AC, WA))



### FIXED CODE ###

N, M = map(int, input().rstrip().split())
AC = 0
WA = 0
data = {}
for _ in range(M):
    tmp = input().rstrip().split()
    p, S =  int(tmp[0]), tmp[1]
    if p not in data.keys():
        if S == 'AC':
            data[p] = {'AC': True, 'WA': 0}
            AC += 1
        elif S == 'WA':
            data[p] = {'AC': False, 'WA': 1}
    else:
        if S == 'AC':
            if data[p]['AC'] is True:
                continue
            elif data[p]['AC'] is False:
                data[p]['AC'] = True
                WA += data[p]['WA']
                AC += 1
        elif S == 'WA':
            if data[p]['AC'] is True:
                continue
            elif data[p]['AC'] is False:
                data[p]['WA'] += 1
print('{} {}'.format(AC, WA))
a = input()
b = input()
print(int(a) * int(b))
print((int(a) + int(b)) * 2)


### FIXED CODE ###


a,b =(int(x) for x in input().split())
print(a * b, (a+b) * 2)
S = input()

if S == 'ARC':
  print('ABC')
else:
  print('ARC)

### FIXED CODE ###

S = input()

if S == 'ARC':
  print('ABC')
else:
  print('ARC')
n, m = input().split()
a = n*(n-1)/2 + m*(m-1)/2
print(a)

### FIXED CODE ###

n, m = map(int, input().split())
a = n*(n-1)/2 + m*(m-1)/2
print(int(a))
h,w = map(int, input().split())
a = [input() for _ in range(4)]

r = [False] * h
c = [False] * w

for i in range(h):
  for j in range(w):
    if a[i][j] == "#":
      r[i] = True
      c[j] = True

for i in range(h):
  if r[i]:
    for j in range(w):
      if c[j]:
        print(a[i][j], end="")
    print()

### FIXED CODE ###

h,w = map(int, input().split())
a = [input() for _ in range(h)]

r = [False] * h
c = [False] * w

for i in range(h):
  for j in range(w):
    if a[i][j] == "#":
      r[i] = True
      c[j] = True

for i in range(h):
  if r[i]:
    for j in range(w):
      if c[j]:
        print(a[i][j], end="")
    print()
a = map(int,input().split(" "))
b = map(int,input().split(" "))
c = map(int,input().split(" "))

d = max(b)- min(b)
e = max(c)- min(c)

f = sum(range(a[0]))
g = sum(range(a[1]))

ans = (d * e * f * g) % (10**9 + 7)



print( (10**9 + 7))

print(ans)

### FIXED CODE ###

a = list(map(int,input().split(" ")))
b = list(map(int,input().split(" ")))
c = list(map(int,input().split(" ")))

x = 0
y = 0

for i in range(1,a[0]):
    x = x + b[i] - b[0]
    
xx = x
for i in range(1,a[0]-1):
    xx = xx - ((b[i] - b[i - 1]) * (a[0] - i))
    x = x + xx

for i in range(1,a[1]):
    y = y + c[i] - c[0]
    
yy = y
for i in range(1,a[1]-1):
    yy = yy - ((c[i] - c[i - 1]) * (a[1] - i))
    y = y + yy

ans = x * y
ans = ans % (10**9 + 7)

print(ans)
def find(s,t):
    if (len(s)==0 or len(t)==0):
        return ""
    if(s[0]==t[0]):
        if(len(s)==1 or len(t)==1):
            return s[0]
        return s[0]+find(s[1:],t[1:])
    x=y=""
    if(len(t)>1):
        x=find(s,t[1:])
    if(len(s)>1):
        y=find(s[1:],t)
    if(len(x)>len(y)):
        return x
    else:
        return y
def solve():
    s=input()
    t=input()
    ans=find(s,t)
    print(ans)

solve()


### FIXED CODE ###

from subprocess import*
call(('pypy3','-c',"""
s=input()
t=input()
a=len(s)
b=len(t)
dp=[[0]*(b+1) for i in range(a+1)]
for i in range(a):
  for j in range(b):
    if s[i]==t[j]:
      dp[i+1][j+1]=dp[i][j]+1
    else:
      dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j])
res=''
while a!=0 and b!=0:
  if dp[a][b]==dp[a-1][b]:
    a-=1
  elif dp[a][b]==dp[a][b-1]:
    b-=1
  else:
    a-=1
    b-=1
    res=s[a]+res
print(res)
"""))
"""
from subprocess import*
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
# import numpy as np
starttime = time.time()
# import numpy as np
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]

try:
    # sys.setrecursionlimit(int(pow(10,6)))
    # sys.stdin = open("input.txt", "r")
    # sys.stdout = open("../output.txt", "w")
except:
    pass

"""
import ans1
import ans2
 
r = float(ans1.stdin.readline())

### FIXED CODE ###

import sys
import math
 
r = float(sys.stdin.readline())
print('%.5f %.5f' % (r**2 * math.pi, r*2 * math.pi))
A, B, C = map(int, input().split())
X = 10*A + B + C
Y = 10*B + A + C
Z = 10*C + A + B
print(max[X, Y, Z])

### FIXED CODE ###

A, B, C = map(int, input().split())
X = 10*A + B + C
Y = 10*B + A + C
Z = 10*C + A + B
print(max(X, Y, Z))
import numpy as np

a, b = map(int, input().split(' '))
lcm = np.lcm(a, b)
print(lcm)

### FIXED CODE ###

from fractions import gcd

a, b = [int(val) for val in input().split(' ')]
lcm = int((a*b)/gcd(a, b))
print(lcm)
N = int(input())
A = sorted(list(map(int, input().split())))
M = int((N + 1)/2)
ans = 0

for i in range(N):
    t = A[i] - A[M]
    if t < 0:
        t = (-1) * t
    ans += t

print(ans)


### FIXED CODE ###

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

for i in range(N):
    B.append(A[i] - i - 1)

B = sorted(B)
M = B[int((N - 1)/2)]
ans = 0

for i in range(N):
    t = B[i] - M
    if t < 0:
        t = (-1) * t
    ans += t

print(ans)
if input()islower():
    print("a")
else:
    print("A")

### FIXED CODE ###

if input().islower():
    print("a")
else:
    print("A")
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

H = readline().decode('utf8')
print(chr(ord(H) + 1))


### FIXED CODE ###

"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

H = readline().decode('utf8').strip()
print(chr(ord(H) + 1))
import numpy as np
N, K = [int(i) for i in input().split()]
array = [int(i) for i in input().split()]

ary = np.array([(1 + n) / 2 for n in array])

cumsum = ary.cumsum()

exv.append(cumsum[K-1])
for i in range(N - K):
    exv.append([cumsum[i+K] - cumsum[i]])
    
print(max(exv)[0])

### FIXED CODE ###

import numpy as np

N, K = [int(i) for i in input().split()]
numbers = [int(i) for i in input().split()]

ary = np.array([(1 + n) / 2 for n in numbers])

cumsum = ary.cumsum()

max_exv = cumsum[K-1]
for i in range(N - K):
    if cumsum[i+K] - cumsum[i] > max_exv:
        max_exv = cumsum[i+K] - cumsum[i]
    
print(max_exv)
# coding: utf-8
# Your code here!
N=int(input())
X=list(input())

ones=X.count("1")
high=ones+1
low=ones-1

mod_h=[1]
mod_l=[1]
for i in range(N-1):
    mod_h.append((mod_h[-1]*2)%high)
    mod_l.append((mod_l[-1]*2)%low)

mod_h=mod_h[::-1]
mod_l=mod_l[::-1]

for i in range(N):
    ans=0
    if X[i]=="0":
        #high_root
        temp=X[:]
        temp[i]="1"
        for j in range(len(temp)):
            if temp[j] == "1":
                ans+=mod_h[j]
        ans%=high
    else:
        temp=X[:]
        temp[i]="0"
        for j in range(len(temp)):
            if temp[j] == "1":
                ans+=mod_l[j]
        ans%=low
    
    count=1
    """
    while ans!=0:
        ans=ans%(bin(ans).count("1"))
        count+=1
    """
    print(count)
    
    

### FIXED CODE ###

# coding: utf-8
# Your code here!
N=int(input())
X=list(input())

ones=X.count("1")
high=ones+1
low=ones-1

mod_h=[1]
mod_l=[1]
for i in range(N-1):
    mod_h.append((mod_h[-1]*2)%high)
    mod_l.append((mod_l[-1]*2)%low if low!=0 else 0) 

mod_h=mod_h[::-1]
mod_l=mod_l[::-1]

ans_high=0
for i in range(N):
    if X[i] == "1":
        ans_high+=mod_h[i]
ans_high%=high

ans_low=0
for i in range(N):
    if X[i] == "1":
        ans_low+=mod_l[i]
ans_low%=low if low!=0 else 1
        
for i in range(N):
    if X[i]=="0":
        ans=ans_high
        ans+=mod_h[i]
        ans%=high
    else:
        if low==0:
            print(0)
            continue
        ans=ans_low
        ans-=mod_l[i]
        ans%=low
    
    count=1
    while ans!=0:
        ans=ans%(bin(ans).count("1"))
        count+=1
    
    print(count)
# -*- coding: utf-8 -*-
import sys
from collections import deque

n, m = map(int, input().split())
g = [[] for _ in range(3 * n)]
for i in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    # u0 -> v1
    g[3 * u].append(3 * v + 1)
    # u1 -> v2
    g[3 * u + 1].append(3 * v + 2)
    # u2 -> v0
    g[3 * u + 2].append(3 * v)

s, t = map(int, input().split())
s = 3 * (s - 1)
t = 3 * (t - 1)

depth = dict()
depth[s] = 0
q = deque([s])


while(len(q) != 0):
    v = q.popleft()
    for u in g[v]:
        if u not in depth:
            q.append(u)
            depth[u] = depth[v] + 1

print(depth[t] // 3 if 3 in depth else -1)

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
from collections import deque

n, m = map(int, input().split())
g = [[] for _ in range(3 * n)]
for i in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    # u0 -> v1
    g[3 * u].append(3 * v + 1)
    # u1 -> v2
    g[3 * u + 1].append(3 * v + 2)
    # u2 -> v0
    g[3 * u + 2].append(3 * v)

s, t = map(int, input().split())
s = 3 * (s - 1)
t = 3 * (t - 1)

depth = dict()
depth[s] = 0
q = deque([s])


while(len(q) != 0):
    v = q.popleft()
    for u in g[v]:
        if u not in depth:
            q.append(u)
            depth[u] = depth[v] + 1

print(depth[t] // 3 if t in depth else -1)
N = int(input())

for h, n in product(range(1, 3501), range(1, 3501)):
    a = (4 * h * n - N * n - N * h)
    if a != 0:
        w = (N * h * n) / a
        if w == w//1 and w > 1:
            print(n,h,w)
            exit()


### FIXED CODE ###

from itertools import product
N = int(input())

for h in range(1, 3501):
    for n in range(1, 3501):
        a = (4 * h * n - N * n - N * h)
        if a > 0 and (N * h * n) % a == 0:
            w = (N * h * n) / a
            int_w = int(w)
            if w == int_w:
                print(n,h,int_w)
                exit()
A, B, K = map(int, input().split())

L = list(range(A,B+1))
L = sorted(list(set(L[:K])|set(L[-K:])))
print(*L, sep='\n')


### FIXED CODE ###

S = list(input().strip())

b = all(i in S for i in 'abc')
print(b and 'Yes' or 'No')
import sys
n, x = [int(i) for i in sys.stdin.readline().split()]
cur = 1
ls = [cur]
for i in range(50):
    cur = cur * 2 + 3
    ls.append(cur)

def f(n, x):
    if x == 1:
        return 0
    elif x <= ls[n-1]:
        return f(n-1, x-1)
    elif x == ls[n-1] + 1:
        return 1 + ls[n-1] // 2 + 1
    elif x < ls[n]:
        return 1 + ls[n-1] // 2 + 1 + f(n-1, x - ls[n-1] - 2)
    else:
        return ls[n] // 2 + 1

res = f(n, x)
print(res)

### FIXED CODE ###

import sys
n, x = [int(i) for i in sys.stdin.readline().split()]
cur = 1
p = 1
ls = [cur]
p_ls = [p]
for i in range(50):
    cur = cur * 2 + 3
    p = p * 2 + 1
    ls.append(cur)
    p_ls.append(p)

def f(n, x):
    if n == 0:
        return 0 if x <= 0 else 1
    if x == 1:
        return 0
    elif x <= 1 + ls[n-1]:
        return f(n-1, x-1)
    elif x == ls[n-1] + 2:
        return 1 + p_ls[n-1]
    elif x < ls[n]:
        return 1 + p_ls[n-1] + f(n-1, x - ls[n-1] - 2)
    else:
        return p_ls[n]
res = f(n, x)
print(res)
N,W = map(int, input().split())
w,v = [0]*N, [0]*N
for _ in range(N):
    w[i],v[i] = map(int, input().split())
    
dp = [[0]*(W+1) for _ in range(N+1)]
for i in range(N):
    for j in range(W+1):
        if j-w[i]<0:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = max(dp[i][j],
                             dp[i][j-w[i]] + v[i])
print(dp[N][W])
# print(dp)

### FIXED CODE ###

N,W = map(int, input().split())
w,v = [0]*N, [0]*N
for i in range(N):
    w[i],v[i] = map(int, input().split())
    
dp = [0]*(W+1) 
for i in range(N):
    for j in reversed(range(W+1)):
        if j-w[i]<0:
            dp[j] = dp[j]
        else:
            dp[j] = max(dp[j],
                        dp[j-w[i]] + v[i])
    # print(dp)
print(dp[W])
A, B, K = map(int, input().split())

def divlist(x):
  numbers = []
  divX = []
  try:
    for i in range(1,x+1):
      numbers.append(i)
      if x % i == 0:
        divX.append(i)
    divX = set(divX)
    return divX
  except ZeroDivisionError:
      print("ZeroDivisionError!!")

divA = divlist(A)
divB = divlist(B)
common = sorted(list(divA & divB))

#print("divA:", divA)
#print("divB:", divB)
#print("divC:", common)
print(common[K-1])

### FIXED CODE ###

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

answer = 0

if B//A < C:
  answer = B//A
else:
  answer = C

print(answer)
N,_,*L=map(int,open(0).read().split());for n in range(N):print(L.count(n+1))

### FIXED CODE ###

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

ans = [0] * N

for _ in range(M):
    a,b = map(int, input().split())
    ans[a-1] += 1
    ans[b-1] += 1

print(*ans, sep='\n')
a, b = input().split()
a = int(a)
b = float(b)
c = int(100*b)
c = str(c)
ans = 0
for i in range(3):
  ans += a * int(c[i]) * 10**(2-i)
ans = ans // 100
print(ans)

### FIXED CODE ###

a, b = input().split()
a = int(a)
b_list = [int(b[0]), int(b[2]), int(b[3])]
ans = 0
for i in range(3):
  ans += a * b_list[i] * 10**(2-i)
ans = ans // 100
print(ans)
def manhattan(n, x, y):
    x2 = [0] * n
    y2 = [0] * n
    for i in range(n):
        x0, y0 = xy[i]
        x2[i] = x0 - y0
        y2[i] = x0 + y0
    print(max(max(x2) - min(x2), max(y2) - min(y2)))

n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
    x[i] , y[i] = map(int, input().split())
manhattan(n, x, y)


### FIXED CODE ###

def manhattan(n, x, y):
    x2 = [0] * n
    y2 = [0] * n
    for i in range(n):
        x2[i] = x[i] - y[i]
        y2[i] = x[i] + y[i]
    print(max(max(x2) - min(x2), max(y2) - min(y2)))

n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
    x[i] , y[i] = map(int, input().split())
manhattan(n, x, y)
import bisect
X,N = map(int, input().split())


if N == 0:
    print(X)
    exit()
    
p = list(map(int,input().split()))

p.sort()
gen = list(range(-1,101))

for i in p:
    gen.remove(i)

index = bisect.bisect(gen,X)

ans = 100000
ans2 = 100000
a = [gen[index-1],gen[index],gen[index+1]]

for i in range(3):
    if ans >= abs(a[i]-X):
        ans = abs(a[i]-X)
        ans2 = a[i]
    else:
        pass
print(ans2)

        
    
    

### FIXED CODE ###

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


if N == 0:
    print(X)
    exit()


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

p.sort()
gen = list(range(-5,120))

for i in p:
    gen.remove(i)

index = bisect.bisect(gen,X)

ans = 100000
ans2 = 100000

a = [gen[index-1],gen[index],gen[index+1]]

for i in range(3):
    check = abs(a[i]-X)
    if ans > check:
        ans = check
        ans2 = a[i]
    
print(ans2)
str_S = raw_input()

list_S = list(str_S)

list_str = []
list_number = []

list_S2 = list_S

for char in list_S:
    number = 0
    list_S2.remove(char)

    if char == 'A' or char == 'C' or char == 'T' or char == 'G':
        number += 1
        for n in list_S2:
            if n == 'A' or n == 'C' or n == 'T' or n == 'G':
                char += n
                number += 1
            else:
                list_str.append(char)
                list_number.append(number)
                break


print int(max(list_number))


### FIXED CODE ###

# coding: utf-8
str_S = raw_input()

list_S = list(str_S)
list = list(str_S)

list_number = []

while list != []:
    number = 0
    for char in list:
        if char == 'A' or char == 'C' or char == 'G' or char == 'T':
            number += 1
        else:
            break
    list_number.append(number)

    for n in range(number + 1):
        if list != []:
            list.pop(0)

print max(list_number)
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

N = getN()
info = []
for i in range(N):
    x, y, h = getNM()
    info.append([x, y, h])

ans = []
for i in range(101):
    for j in range(101):
        X = i
        Y = j
        height = []
        flag = True
        for k in range(N):
            minusx = abs(X - info[k][0])
            minusy = abs(Y - info[k][1])
            if info[k][2] != 0:
                h = info[k][2] + minusx + minusy
                if k != 0 and h != height[-1]:
                    flag = False
                    break
                height.append(h)
        if flag:
            ans = [i, j, height[0]]
print(*ans)

### FIXED CODE ###

def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

N = getN()
info = []
for i in range(N):
    x, y, h = getNM()
    info.append([x, y, h])
info.sort(reverse = True,key = lambda info:info[2])

ans = []
for i in range(101):
    for j in range(101):
        height = -1
        flag = True
        for k in range(N):
            minusx = abs(i - info[k][0])
            minusy = abs(j - info[k][1])
            if height == -1:
                # 上で逆順にソートしてるので確実に１以上の高さがでる
                height = info[k][2] + minusx + minusy
            else:
                # 問題の式に沿うように
                if info[k][2] != max(height - minusx - minusy, 0):
                    flag = False
                    break
        if flag:
            ans = [i, j, height]
print(*ans)
s=input()
n=int(input())
r=-1
f=[]
b=[]
for i in range(n):
    q=input().split()
    if q[0]=='1':
        r*=-1
    else:
        t=int(q[1])
        if t*r==-1 or t*r==2 :
            f.append(q[2])
        else:
            b.append(q[2])
s=f[::-1]+s+b
if r==1:
    s=s[::-1]
print(s)
            


### FIXED CODE ###

s=input()
n=int(input())
r=-1
f=[]
b=[]
for i in range(n):
    q=input().split()
    if q[0]=='1':
        r*=-1
    else:
        t=int(q[1])
        if t*r==-1 or t*r==2 :
            f.append(q[2])
        else:
            b.append(q[2])
f=''.join(f)
b=''.join(b)
s=f[::-1]+s+b
if r==1:
    s=s[::-1]
print(s)
n , k = map(int, input().split())
a = list(map(int, input().split()))
neg = []
pos = []
mod = 10**9+7
for i in range(n):
    if a[i] >= 0:
        pos.append(a[i])
    else:
        neg.append(a[i])
neg.sort()
pos.sort(reverse = True)
min_num = -1
good_num = -1
if len(pos) == 0 and n == k:
    ans = 1
    neg.sort(reverse = True)
    for i in range(k):
        ans *= neg[i]
        ans %= mod
    print(ans % mod)
else:
    #最大化するとき
    for i in range(0,k+1,2):
        #i個だけnegから取る。
        if i > len(neg) or k - i > len(pos):
            continue
        m = 0
        if i - 1 >= 0:
            m = abs(neg[i-1])
        if k-i-1 >= 0:
            m = min(m, pos[k-i-1])
        if m > min_num:
            min_num = m
            good_num = i
    ans = 1
    #print(good_num)
    for i in range(good_num):
        ans *= neg[i]
        ans %= mod
    for i in range(k - good_num):
        ans *= pos[i]
        ans %= mod
    print(ans % mod)

### FIXED CODE ###

n , k = map(int, input().split())
a = list(map(int, input().split()))
neg = []
pos = []
mod = 10**9+7
for i in range(n):
    if a[i] >= 0:
        pos.append(a[i])
    else:
        neg.append(a[i])
neg.sort()
pos.sort(reverse = True)
if (len(pos) == 0 and k % 2 == 1) or n == k:
    ans = 1
    a.sort(reverse = True)
    for i in range(k):
        ans *= a[i]
        ans %= mod
    print(ans % mod)
else:
    #最大化するとき
    from collections import deque
    ans = 1
    neg_new = []
    for i in range(0, len(neg)//2):
        neg_new.append(neg[2*i] * neg[2*i+1])
    neg_new = deque(sorted(neg_new, reverse = True))
    pos = deque(pos)
    if k % 2 == 1:
        k -= 1
        ans = pos.popleft()
    else:
        ans = 1
    while k > 0:
        if len(pos) >= 2 and len(neg_new) >= 1:
            if pos[0] * pos[1] > neg_new[0]:
                ans *= pos.popleft() * pos.popleft()
            else:
                ans *= neg_new.popleft()
        elif len(pos) >= 2:
            ans *= pos.popleft() * pos.popleft()
        else:
            ans *= neg_new.popleft()
        k -= 2
        ans %= mod
    print(ans % mod)
data = input().split()

if data[0] < 10:
  if data[1] < 10:
    answer = data[0]*data[1]
    
return answer

### FIXED CODE ###

data = list(map(lambda x: int(x), input().split()))
     
if __name__ == "__main__":
  if data[0] < 10:
    if data[1] < 10:
      answer = data[0]*data[1]
    else:
      answer = -1
  else:
    answer = -1
    
  print(answer)
abc = 'ABC'
N = int(input().rstrip())
S = input().rstrip()
ret = 0
if len(S) == 3 and S == 'ABC':
    ret = 1
else:
    for i in range(N - len(abc)):
        if 'ABC' == S[i:i + 3]:
            ret += 1
print(ret)


### FIXED CODE ###

K, X = map(int, input().rstrip().split())
ret = 'Yes' if  K*500 >= X else 'No'
print(ret)
hoge = ["FizzBuzz" if i % 3 == 0 and i % 5 == 0 else("Fizz" if i % 3 == 0 else("Buzz" if i % 5 == 0 else str(i))) for i in range(10001)]

while True:
    m, n = map(int, input().split())
    if m == 0:
        break
    man = [str(i) for i in range(1, m+1)]
    a, b = divmod(n, m)
    man = a*man+man[:b]
    idx, k = 0, 1
    while k < n+1:
        x = input()
        if hoge[i] == x:
            idx += 1
        else:
            v = man[idx]
            man = list(filter((v).__ne__, man))
            if len(set(man)) == 1:
                for i in range((n+1)-k):
                    input()
                break
        k += 1
    print(*sorted(list(set(man))))

### FIXED CODE ###

hoge = ["FizzBuzz" if i % 15 == 0 else("Fizz" if i % 3 == 0 else("Buzz" if i % 5 == 0 else str(i))) for i in range(10001)]

while True:
    m, n = map(int, input().split())
    if m == 0:
        break
    man = list(range(1, m+1))
    game = [input() for _ in range(n)]
    idx = 0
    for i in range(n):
        if game[i] != hoge[i+1]:
            del man[idx]
            if len(man) == 1:
                break
        else:
            idx += 1
        idx %= len(man)
    print(*man)