Harryxun/stf_run huggingface dataset:
S = input()
 
for i in range(0,int(len(S)):
	if i % 2 == 0:
		if L[i] == "L": #奇数
			print("No")
		break
	elif i % 2 == 1
		if L[i] == "R":
			print("No")
		break
else:print("Yes")	 

### FIXED CODE ###

L = input()
 
for i in range(0,int(len(L))):
	if (i % 2) == 0:
		if L[i] == "L": #奇数
			print("No")
			break
	elif (i % 2) == 1:
		if L[i] == "R":
			print("No")
			break
else:print("Yes")
s = input()
q = int(input())
is_r = False
f_list = []
b_list = []

for i in range(q):
    q_i = input().split(' ')
    t_i = q_i[0]
    if t_i == '1':
        is_r = not is_r
    else:
        f_i = q_i[1]
        if (f_i == '1' and not is_r) or (f_i == '2' and is_r):
            f_list.append(q_i[2])
        else:
            b_list.append(q_i[2])

f_list = f_list[::-1]
f_list.append(s)
f_list.extend(b_list)
s = f_list.join('') if not is_r else f_list[::-1].join('')
print(s)

### FIXED CODE ###

s = input()
q = int(input())
is_r = False
f_list = []
b_list = []

for i in range(q):
    q_i = input().split(' ')
    t_i = q_i[0]
    if t_i == '1':
        is_r = not is_r
    else:
        f_i = q_i[1]
        if (f_i == '1' and not is_r) or (f_i == '2' and is_r):
            f_list.append(q_i[2])
        else:
            b_list.append(q_i[2])

f_list = f_list[::-1]
f_list.append(s)
f_list.extend(b_list)
s = ''.join(f_list) if not is_r else ''.join(f_list)[::-1]
print(s)
def LI():
	return [ int(s) for s in input().split() ]

A = LI()

A12 = abs(A[0]-A[1])
A23 = abs(A[1]-A[2])
A31 = abs(A[3]-A[1])

print(min(A12+A23,A23+A31,A31+A12))



### FIXED CODE ###

def LI():
	return [ int(s) for s in input().split() ]
 
A = LI()
 
A12 = abs(A[0]-A[1])
A23 = abs(A[1]-A[2])
A31 = abs(A[2]-A[0])
 
print(min(A12+A23,A23+A31,A31+A12))
memory = [[-1 for i in range(W)] for j in range(H)]
def flip_count_mem(r, c):
  if memory[r][c] < 0:
    memory[r][c] = flip_coumt(r, c)
  return memory[r][c]

def flip_count (r, c):
  if r == H - 1 and c == W - 1:
    if s[r][c] == "#":
      return 1
    else:
      return 0
  #右に行ったとき
  if c == W - 1:
    count_right = 10000
  else:
    count_right = flip_count_mem (r, c + 1)
    if s[r][c] == "#" and s[r][c + 1] == ".":
      count_right += 1
  #下に行ったとき
  if r == H - 1:
    count_down = 10000
  else:
    count_down = flip_count_mem (r + 1, c)
    if s[r][c] == "#" and s[r + 1][c] == ".":
      count_down += 1
  return min(count_right, count_down)

H, W = input().split()
W = int (W)
H = int (H)
s = []
for i in range(H):
  s.append(input())
print (flip_count(0, 0))


### FIXED CODE ###

def flip_count_mem(r, c):
  if memory[r][c] < 0:
    memory[r][c] = flip_count(r, c)
  return memory[r][c]

def flip_count (r, c):
  if r == H - 1 and c == W - 1:
    if s[r][c] == "#":
      return 1
    else:
      return 0
  #右に行ったとき
  if c == W - 1:
    count_right = 10000
  else:
    count_right = flip_count_mem (r, c + 1)
    if s[r][c] == "#" and s[r][c + 1] == ".":
      count_right += 1
  #下に行ったとき
  if r == H - 1:
    count_down = 10000
  else:
    count_down = flip_count_mem (r + 1, c)
    if s[r][c] == "#" and s[r + 1][c] == ".":
      count_down += 1
  return min(count_right, count_down)

H, W = input().split()
W = int (W)
H = int (H)
s = []
for i in range(H):
  s.append(input())
memory = [[-1 for i in range(W)] for j in range(H)]
print (flip_count(0, 0))
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
a=[list(map(int,input().split())) for k in range(n)]
 
count=0
 
for i in range(n)
       absum=0
       for j in range(m)
       absum +=a[i][j]*b[j]
       
       ans=absum+c
       if ans>0:
       count +=1
print(count)       

### FIXED CODE ###

n,m,c=map(int,input().split())
B=list(map(int,input().split()))
A=[list(map(int,input().split()))for i in range(n)] #二次元配列でとっています
cnt=0
for i in range(n):
    total=0
    for j in range(m):
        total+=B[j]*A[i][j]
    total+=c
    if 0<total:
        cnt+=1
print(cnt)
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()

"""========main code==============="""

a,b=ml()
n=set()
for i in range(b):
    n.add(ii())
r=0
for i in range(a,1001):
    if(i not in n):
        r=i
        break
l=0    
for i in range(a-1,-1,-1):
    if(i not in n):
        l=i
        break
if(abs(l-a)<=abs(r-a)):
    print(l)
else:
    print(r)

### FIXED CODE ###

import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()

"""========main code==============="""

a,b=ml()
if(b==0):
    n=set()
else:
    n=ll()
    n=set(n)
r=0
for i in range(a,1001):
    if(i not in n):
        r=i
        break
l=0    
for i in range(a-1,-1,-1):
    if(i not in n):
        l=i
        break
if(abs(l-a)<=abs(r-a)):
    print(l)
else:
    print(r)
n = int(input())
dict = []
for i in range(n):
    order = input().split()
    if order[0] == "insert":
        dict.append(order[1])
    else:
        if order[1] in dict:
            print(Yes)

### FIXED CODE ###

from collections import deque

n = int(input())
dict = {}
for i in range(n):
    order = input().split()
    if order[0] == "insert":
        dict[order[1]] = i
    else:
        if order[1] in dict:
            print("yes")
        else:
            print("no")
n=int(input())
a+=list(map(int,input().split()))
for i in range(n-1):
  if a[i]!=i+1:
    c+=1
print("YES" if c<3 else "NO")
  


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
c=0
for i in range(n-1):
  if a[i]!=i+1:
    c+=1
print("YES" if c<3 else "NO")
mod=10**9+7
n=int(input())
a=list(map(int,input().split()))
b=[0,0,0]
ans=1
for i in a:
  ans*=b.count(i)
  b[b.index(i)]+=1
print(ans%mod)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
m=10**9+7
b=[0]*3
ans=1
for i in a:
  ans*=b.count(i)
  ans%=m
  for j in range(3):
    if b[j]==i:
      b[j]+=1
      break
print(ans%m)
from fractions import gcd
import math

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


def lcm(x, y):
    if math.gcd(x, y) == 0:
        return x * y
    return x * y / gcd(x, y)


def cantdiv(x):
    return x - math.floor(x / c) - math.floor(x / d) + math.floor(x / lcm(c, d))


print(cantdiv(b) - cantdiv(a - 1))


### FIXED CODE ###

from fractions import gcd

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


def lcm(x, y):
    if gcd(x, y) == 0:
        return x * y
    return x * y // gcd(x, y)


def cantdiv(x):
    return x - x // c - x // d + x // lcm(c, d)


print(cantdiv(b) - cantdiv(a - 1))
N = int(input())
hlist = list(map(int, input().split()))

dp = [0 for _ in range(N)]
def f(i, n):
  if i==0:
    return n
  if i==1:
    return n + abs(hlist[1]-hlist[0])
  return min(f(i-1, n+abs(hlist[i]-hlist[i-1])), f(i-2, n+abs(hlist[i]-hlist[i-2])))
print(f(N-1, 0))

### FIXED CODE ###

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

dp = [-1 for _ in range(N)]
dp[0] = 0
for n in range(N-2):
  cost = dp[n] + abs(hlist[n]-hlist[n+1])
  dp[n+1] = min(dp[n+1], cost) if dp[n+1] != -1 else cost
  cost = dp[n] + abs(hlist[n]-hlist[n+2])
  dp[n+2] = min(dp[n+2], cost) if dp[n+2] != -1 else cost
cost = dp[-2] + abs(hlist[-2]-hlist[-1])
dp[-1] = min(dp[-1], cost) if dp[-1] != -1 else cost
print(dp[-1])
def resolve():
    # 整数 1 つ
    n = str(input())
    # 整数複数個
    # a, b, c = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]
    n[3] = "8"

    print(n)


resolve()


### FIXED CODE ###


def resolve():
    # 整数 1 つ
    n = input()
    # 整数複数個
    # a, b, c = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]
    m = n[:3] + "8" + n[4:]

    print(m)


resolve()
def f(A): return A.count(a)>1
R=[0,3,6]
N=range(9)
Z=[0]*9

n=input()
while n:
  F=[[" " for _ in Z] for _ in Z]
  M=[map(int,raw_input().split()) for _ in Z]
  M1=[[M[y][x] for y in N] for x in N]
  M2=[M[y][x:x+3]+M[y+1][x:x+3]+M[y+2][x:x+3] for y in R for x in R]
  for y in N:
    p0=y/3*3
    for x in N:
      a=M[y][x]
      if any(map(f,[M[y],M1[x],M2[p0+x/3]])): F[y][x]="*"
    print "".join([a+b for a,b in zip(F[y],map(str,A))])
  if n>1: print
  n-=1

### FIXED CODE ###

def f(A): return A.count(a)>1
R=[0,3,6]
N=range(9)
Z=[0]*9

n=input()
while n:
  F=[[" " for _ in Z] for _ in Z]
  M=[map(int,raw_input().split()) for _ in Z]
  M1=[[M[y][x] for y in N] for x in N]
  M2=[M[y][x:x+3]+M[y+1][x:x+3]+M[y+2][x:x+3] for y in R for x in R]
  for y in N:
    p0=y/3*3
    for x in N:
      a=M[y][x]
      if any(map(f,[M[y],M1[x],M2[p0+x/3]])): F[y][x]="*"
    print "".join([a+b for a,b in zip(F[y],map(str,M[y]))])
  if n>1: print
  n-=1
import sys
 
N, Y = [int(x) for x in sys.stdin.readline().strip().split()]
 
a = Y // 10000
b = (Y - a * 10000) // 5000
c = (Y - a * 10000 - b * 5000) // 1000
 
t = a + b + c
if N >= t + 9:
    l = (N - t - 9) // 9
    a -= l
    c += l * 10
 
t = a + b + c
if N >= t + 4:
    l = (N - t - 4) // 4
    b -= l
    c += l * 5
 
t = a + b + c
if N >= t:
    l = N - t
    a -= l
    b += l * 2
 
if a + b + c > N and a >= 0 and b >= 0 and c >= 0:
    print("-1 -1 -1")
else:
    print(a, b, c)


### FIXED CODE ###

import sys

line = sys.stdin.readline().strip()
print(line[:3]+"8"+line[4:])
S = input()
a = 700
if S[0] ++ "o":
  a += 100
if S[1] ++ "o":
  a += 100
if S[2] ++ "o":
  a += 100
print(a)


### FIXED CODE ###

S = input()
a = 700
if S[0] == "o":
  a += 100
if S[1] == "o":
  a += 100
if S[2] == "o":
  a += 100
print(a)
t = int(input())
s = input()
if(s[0:t//2]==s[t//2:t]:
   print("Yes")
else:
   print("No")

### FIXED CODE ###

t = int(input())
s = input()
if(s[0:t//2]==s[t//2:t]):
   print("Yes")
else:
   print("No")
# -*- coding: utf-8 -*-

import sys

def main():
  argNum = int(sys.argv[1])
  print(intRes*intRes*intRes)

if __name__ == '__main__':
  main()

### FIXED CODE ###

# -*- coding: utf-8 -*-

import math

def main():
  N = float(input())
  print(int(math.pow(N,3)))

if __name__ == '__main__':
  main()
n = int(input())
text = input()            # テキストをリストに変換
pattern = list('ABC')          # パターンをリストに変換
cnt = 0

for i in range(n):
    match = True                # 一致しているものとして探索開始
    for j in range(len(pattern)):
        if text[i + j] != pattern[j]:
            match = False       # 一致しなかった
            break
    if match:                   # すべての文字が一致していればカウント
        cnt += 1

print(cnt)

### FIXED CODE ###

n = int(input())
s = input()      
pattern = list('ABC')          
cnt = 0

for i in range(n-len(pattern)+1):
    if s[i] == pattern[0]:
        if s[i+1] == pattern[1]:
            if s[i+2] == pattern[2]:
                cnt += 1

print(cnt)
from operator import itemgetter

N = int(input())


A = []
for i in range(N - 1):
    A.append([int(i) for i in input().split()])

B = []
for row in A:
    B.append(sorted(row))
B.sort(key = itemgetter(0))

link_list = [[] for i in range(N)]
for row in B:
    link_list[row[0] - 1].append(row[1] - 1)
    link_list[row[1] - 1].append(row[0] - 1)
edge_color = dict()
marker = [0] * N


def DFS_color(node, pre_color):
    target_list = link_list[node]
    color = 1
    for ko_node in target_list:
        if marker[ko_node] == 0:
            if pre_color == color:
                color += 1
            #edge_color[node, ko_node] = color
            #edge_color[ko_node, node] = color 
            marker[ko_node] = 1
            DFS_color(ko_node, color)
            color += 1
        else:
            pass

marker[0] = 1
DFS_color(0, 0)
"""
print(max(edge_color.values()))
for node1, node2 in A:
    print(edge_color[node1 - 1, node2 - 1])
"""

### FIXED CODE ###

from operator import itemgetter
import sys
sys.setrecursionlimit(10**7)

N = int(input())


A = []
for i in range(N - 1):
    A.append([int(i)-1 for i in input().split()])

B = []
for row in A:
    B.append(sorted(row))
B.sort(key = itemgetter(0))

link_list = [[] for i in range(N)]
for row in B:
    link_list[row[0]].append(row[1])
    link_list[row[1]].append(row[0])
edge_color = dict()
marker = [0] * N


def DFS_color(node, pre_color):
    target_list = link_list[node]
    color = 1
    for ko_node in target_list:
        if marker[ko_node] == 0:
            if pre_color == color:
                color += 1
            edge_color[node, ko_node] = color
            edge_color[ko_node, node] = color 
            marker[ko_node] = 1
            DFS_color(ko_node, color)
            color += 1
        else:
            pass

marker[0] = 1
DFS_color(0, 0)

print(max(edge_color.values()))
for node1, node2 in A:
    print(edge_color[node1, node2])
n=int(input())
p=n%10
if p in [2,4,5,7,9]:
  return "hon"
elif p in [0,1,6,8]:
  return "pon"
return "bon"

### FIXED CODE ###

n=int(input())
p=n%10
if p in [2,4,5,7,9]:
  print("hon")
elif p in [0,1,6,8]:
  print("pon")
else:
  print("bon")
A,B = map(int(input().split()))
ans = (A-1)*(B-1)
print(ans)

### FIXED CODE ###

A,B = map(int,(input().split()))
ans = (A-1)*(B-1)
print(ans)
if S == 'ABC':
	print('ARC')
else:
  print('ABC')

### FIXED CODE ###

S = input()
if S == 'ABC':
  print('ARC')
else:
  print('ABC')
N = int(input())
l =[]
#deal with error
for i in range(N):
    l.append(int(input()))
    if i == 0 and l[i]!=0:
        print(-1)
        break
    if i>=1:
        if l[i]-l[i-1]>1 :
            print(-1)
            break

counter=0#answerになる。
counter_n=l[0]#listの中の重複を数える。
l = l[::-1]
for i in range(N-1):
    if l[i]<l[i+1]:
        counter+=counter_n
        counter_n=0#初期化
    elif l[i]==l[i+1]:
        if counter_n == 0:
            counter_n = 2*l[i]
        else:
            counter_n += l[i]
        counter_n += l[i]
    elif l[i] == l[i+1]+1:
        counter += 1
counter += counter_n
print(counter)
        
        


### FIXED CODE ###

import sys
N = int(input()) 
A = [int(sys.stdin.readline()) for _ in range(N)]
b = 0
for i, a in enumerate(A):
    if i + b < a:
        print(-1)
        sys.exit()
    else:
        b = a - i
ans = 0
pre = -1
for a in A[::-1]:
    if pre - 1 != a:
        ans += a
    pre = a
print(ans)
a1,a2,a3=int(input(),split())
if a1+a2+a3>=22 :
    print('bust')
elif a1+a2+a3<22 :
    print('win')

### FIXED CODE ###

a1,a2,a3=map(int,input().split())
if a1+a2+a3>=22 :
    print('bust')
elif a1+a2+a3<22 :
    print('win')
import sys
import numpy as np

def main():
    input = sys.stdin.readline
    N, T = map(int, input().split())
    dishes = []
    for _ in range(N):
        a, b = map(int, input().split())
        dishes.append((a, b))
    
    dishes = sorted(dishes, key=lambda x: x[0])
    
    ans = 0
    dp = np.zeros(T, dtype=int)
    for a, b in dishes:
        ans = max(ans, dp.max() + b)
        np.maximum(dp[:-a] + b, dp[a:], out=dp[a:])

    return ans

if __name__ == '__main__':
    print(main())

### FIXED CODE ###

import sys
import numpy as np

def main():
    input = sys.stdin.readline
    N, T = map(int, input().split())
    dishes = []
    for _ in range(N):
        a, b = map(int, input().split())
        dishes.append((a, b))
    
    dishes = sorted(dishes, key=lambda x: x[0])
    
    ans = 0
    dp = np.zeros(T, dtype=int)
    for a, b in dishes:
        ans = max(ans, dp.max() + b)
        np.maximum(dp[:-a] + b, dp[a:], out=dp[a:])

    return ans

if __name__ == '__main__':
    print(main())
K = int(input())

a = [0] * 1000000
a[0] = 7 % K
for i in range(1000000):
    a[i+1] = (a[i] * 10 + 7) % K 
    
    if (a[i] == 0):
        break

if(i == 999999):
    print('-1')
else:
    print(i+1)


### FIXED CODE ###

K = int(input())

a = [0] * 1000001
a[0] = 7 % K
for i in range(1000000):
    a[i+1] = (a[i] * 10 + 7) % K 
    
    if (a[i] == 0):
        break

if(i == 999999):
    print('-1')
else:
    print(i+1)
import sys
n,m=list(map(int,input().split()))
ans=[-1 for i in range(n)]

for i in range(m):
  s,c=list(map(int,input().split()))
  if n!=1 and s==1 and c==0:
    print(-1)
    sys.exit()
  if ans[s-1]==-1 or ans[s-1]==c:
    ans[s-1]=c
  else:
    print(-1)
    sys.exit()

    
if n==1 and (ans[0]==0　or ans[0]==-1)
  print(0)
  sys.exit()
if ans[0]==-1:
  ans[0]=1
for i in range(1,n):
  if ans[i]==-1:
    ans[i]=0
ans=map(str, ans)
print("".join(ans))

  

### FIXED CODE ###

import sys
n,m=list(map(int,input().split()))
ans=[-1 for i in range(n)]

for i in range(m):
  s,c=list(map(int,input().split()))
  if n!=1 and s==1 and c==0:
    print(-1)
    sys.exit()
  if ans[s-1]==-1 or ans[s-1]==c:
    ans[s-1]=c
  else:
    print(-1)
    sys.exit()

    
if n==1 and (ans[0]==0 or ans[0]==-1):
  print(0)
  sys.exit()
if ans[0]==-1:
  ans[0]=1
for i in range(1,n):
  if ans[i]==-1:
    ans[i]=0
ans=map(str, ans)
print("".join(ans))
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

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

for i in range(K):
  print(cmb(N-K+1,i+1)*cmb(K-1,i)%1000000007)

### FIXED CODE ###

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

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

for i in range(K):
  if N-K+1 < i+1:
    print(0)
  else:
    print(cmb(N-K+1,i+1)*cmb(K-1,i)%1000000007)
from math import ceil
N, M = map(int, input().split())
A = list(map(int, input().split()))
m = min(A)
A = [a // 2 for a in A]


# 最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


# 最小公倍数
def lcm(a, b):
    return a * b // gcd(a, b)


while len(A) > 1:
    A.append(lcm(A.pop(), A.pop()))

X = A[0]
print(ceil((M // X) / 2) - int(X / m < 1))


### FIXED CODE ###

from math import ceil
N, M = map(int, input().split())
A = list(map(int, input().split()))


# 2で割ったものに置き換え
A = [a // 2 for a in A]


# 各要素について、2で割り切れる回数が等しいかチェック
count_div_2 = None
for a in A:
    cnt = 0
    while a % 2 == 0:
        a //= 2
        cnt += 1

    if count_div_2 is None:
        count_div_2 = cnt
    elif cnt != count_div_2:
        print(0)
        exit()


# 最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


# 最小公倍数
def lcm(a, b):
    return a // gcd(a, b) * b


while len(A) > 1:
    a, b = A.pop(), A.pop()
    my_lcm = lcm(a, b)

    # Mを超えたlcmは意味がない
    if my_lcm > M:
        print(0)
        exit()

    A.append(my_lcm)


print(ceil(M // A[0] / 2))
N = input()
K = int(input())
if len(N) == 1:
  print(N[0])
elif K = 1:
  print(N[0])
elif N[0] == '1':
  print(N[1])
else:
  print(N[0])
  

### FIXED CODE ###

N = input()
K = int(input())
ans = '1'
for i in range(K):
  if i >= len(N):
    break
  if N[i] != '1':
    ans = N[i]
    break
print(ans)
N = int(input())

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

ans = B[0] + B[N-1]

for i in range(1,N):
    ans+=min(B[i],B[i-1])
    
print(ans)

### FIXED CODE ###

N = int(input())

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

ans = B[0] + B[N-2]

for i in range(1,N-1):
    ans+=min(B[i],B[i-1])
    
print(ans)
a,b = input().split()
a = int(a)
b = int(b*100)

print((a*b)//100)

### FIXED CODE ###

a,b = input().split()
a = int(a)
b100 = int(b[0])*100+int(b[2])*10+int(b[3])

print((a*b100)//100)
n = int(input())
p = [int(_) for _ in input().split()]

cnt = 0
for i in range(0, n-2):
    print(p[i], p[i+1], p[i+2])
    if (p[i] < p[i+1] < p[i+2]) or (p[i] > p[i+1] > p[i+2]):
        cnt += 1
print(cnt)

### FIXED CODE ###

S = input()
wk1 = (S[0]==S[1]) and (S[2]==S[3]) and (S[0]!=S[2])
wk2 = (S[0]==S[3]) and (S[1]==S[2]) and (S[0]!=S[1])
wk3 = (S[0]==S[2]) and (S[1]==S[3]) and (S[0]!=S[1])
if wk1 or wk2 or wk3:
    print("Yes")
else:
    print("No")
import numpy as np

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

sosu = []
count = 0

def loop(target, A):
  global count
  B = []
  flg = True
  for i in range(len(A)):
    if A[i] % target != 0:
      B.append(A[i])
    if target == A[i]:
      flg = False
  if flg:
    count+=1
  if len(B) == 1:
    count+=1
    return
  target = B.pop(0)
  loop(target, B)

target = A.pop(0)
loop(target, A)
print(count)

### FIXED CODE ###

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

m_a = max(A)+1
B = [0]*(m_a)

for i in A:
  B[i]+=1
  if B[i] == 1:
    for j in range(i*2, m_a, i):
      B[j]+=100
print(B.count(1))
url = "https://atcoder.jp/contests/abc162/tasks/abc162_d"
import itertools


def main():
    n, k = list(map(int, input().split()))
    a = list(map(int, input().split()))
    route = []
    istuka = [0] * (n+1)
    next = 1
    # 同じ街に訪れるまでループ
    for _ in range(k):
        if istuka[next] == 1:
            break
        else:
            istuka[next] = 1
            route.append(next)
        next = a[next - 1]
    ans = route[route.index(next):]
    idx = (k - route.index(next)) % len(ans)
    print(ans[idx])



if __name__ == '__main__':
    main()

### FIXED CODE ###


url = "https://atcoder.jp/contests/abc162/tasks/abc162_d"
import itertools


def main():
    n, k = list(map(int, input().split()))
    a = list(map(int, input().split()))
    route = []
    istuka = [0] * (n+1)
    next = 1
    # 同じ街に訪れるまでループ
    for _ in range(k):
        if istuka[next] == 1:
            break
        else:
            istuka[next] = 1
            route.append(next)
        next = a[next - 1]
    if n >= k:
        print(next)
        exit()
    ans = route[route.index(next):]
    idx = (k - route.index(next)) % len(ans)
    print(ans[idx])



if __name__ == '__main__':
    main()
x = int(input())
a, b = (abs(int(i)-x) for i in input().split())
if a > b:
  print("B")
else:
  print("A")


### FIXED CODE ###

x, a, b = (int(i) for i in input().split())
if abs(a-x) > abs(b-x):
  print("B")
else:
  print("A")
a = int(input())
b = int(input())
c = int(input())
d = int(input())

num_listx = []
num_listy = []

for num in range(b):
  if num >= a:
    num_listx.append(num)
for nums in range(d):
  if nums >= c:
    num_listy.append(nums)
find_max = []
for i in range(len(num_listx)):
  find_max.append(num_listx[i] * num_listy[i])
print(max(find_max))

### FIXED CODE ###

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

ans = max(a*c,a*d,b*c,b*d)

print(ans)
N,K = map(int,input().split())
li = list(map(int,input().split()))
li.sort(reverse = True)
total = 0
for i in li[:K]
  total += i
  
print(total)

### FIXED CODE ###

N,K = map(int,input().split())
li = list(map(int,input().split()))
li.sort(reverse = True)
total = 0
for i in li[:K]:
  total += i
  
print(total)
# coding:utf-8
A = int(input())
B = int(input())
if (1 <= A <= 9) and (1 <= B <= 9):
    print(A*B)
else:
    print(-1)


### FIXED CODE ###

# coding:utf-8
[A, B] = [int(i) for i in input().split(" ")]
if (1 <= A <= 9) and (1 <= B <= 9):
    print(A*B)
else:
    print(-1)
def inputlist():
	n=int(input())
	A=list()
	for i in range(n):
		Ai = int(input())
		s=list()
		for i in range(Ai):
			s += input().split()
		s = [int(i) for i in s]
		A.append(s)
	return A

A=inputlist()
n=len(A)
ans=0
for i in range(2**n):
	bit_str = str(format(i,'015b'))
	p = 0
	for j in range(n):
		if ((i >> j) & 1):
			for k in range(0,len(A[j])-1,2):
				if (int(bit_str[(-1*A[j][k])-1]) == A[j][k+1]):
					p=1
					continue
				else:
					p=0
					break
	if (p):
		ans+=1
print(ans)

### FIXED CODE ###

def inputlist():
	n=int(input())
	A=list()
	for i in range(n):
		Ai = int(input())
		s=list()
		for i in range(Ai):
			s += input().split()
		s = [int(i) for i in s]
		A.append(s)
	return A
A=inputlist()
n=len(A)
ans=0
for i in range(2**n):
	p = 1
	bit_str = str(format(i,'015b'))
	for j in range(n):
		if ((i >> j) & 1):
			for k in range(0,len(A[j]),2):
				if not(A[j][k+1] == int(bit_str[-1*A[j][k]])):
					p = 0
	if (p):
		ans = max(ans,bit_str.count('1'))
print(ans)