Harryxun/stf_run huggingface dataset:
import re
n=int(input())

s = ""
for _ in range(n):
    d1,d2 = input().split()
    if d1==d2:
        s+="1"
    else:
        s+="0"
#print(s)
a = max([len(x) for x in re.findall(r"1+", s)])
if a >= 3:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import re
n=int(input())

s = ""
for _ in range(n):
    d1,d2 = input().split()
    if d1==d2:
        s+="1"
    else:
        s+="0"
#print(s)
try:
    a = max([len(x) for x in re.findall(r"1+", s)])
    if a >= 3:
        print("Yes")
    else:
        print("No")
except:
    print("No")
x, n = list(map(int, input().split()))
p = list(map(int, input().split()))

sample = list(range(0,max(p)+2)) 
reject = list(set(p))

for i in range(len(reject)):
    sample.remove(reject[i])

champ = abs(sample[0] - x)
ans = sample[0]
for i in range(1, len(sample)):
    if abs(sample[i] - x) < champ:
        champ = abs(sample[i] - x)
        ans = sample[i]
    elif abs(sample[i] - x) == champ:
        if ans >= sample[i]:
            ans = sample[i]
        else:
            pass
    else:
        pass
    
print(ans)        

### FIXED CODE ###

x, n = list(map(int, input().split()))
if n >= 1:
    p = list(map(int, input().split()))

    sample = list(range(0,max(p)+2)) 
    reject = list(set(p))

    for i in range(len(reject)):
        sample.remove(reject[i])

    champ = abs(sample[0] - x)
    ans = sample[0]
    for i in range(1, len(sample)):
        if abs(sample[i] - x) < champ:
            champ = abs(sample[i] - x)
            ans = sample[i]
        elif abs(sample[i] - x) == champ:
            if ans >= sample[i]:
                ans = sample[i]
            else:
                pass
        else:
            pass

    print(ans) 

else:
    print(x)
N=input()
H=list(map(int,input().split()))

cnt=1

for i in range(N+1):
  if H[i] < H[i+1]:
    cnt+=1
print(cnt)

### FIXED CODE ###

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

cnt=0

for i in range(0,N):
  if max(H[0:i+1]) <= H[i]:
    cnt+=1
print(cnt)
N = input()
if N % sum([int(i) for i in str(N)]) == 0: print('Yes')
else: print('No')

### FIXED CODE ###

N = int(input())
S =  sum((int(i) for i in str(N)))
if N % S == 0: print('Yes')
else: print('No')
a = int(input())
b = int(input())
if ( a * b ) % 2 == 0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

a, b = (int(x) for x in input().split())
if a*b%2 == 0:
    print('Even')
else:
    print('Odd')
x ** 3

### FIXED CODE ###

x = int(input())
print(x**3)
def main():
    n,a,b,c,d=map(int,input().split(' '))
    s=input()
    result = 'Yes'
    if a<b<d<c:
        tmp =0
        cnt=0
        for i in range(b-2,d+1):
            if s[i]=='#'and s[i+1]=='#':
                result='No'
                break
            if s[i]=='.':
                tmp +=1
            else:
                if cnt < tmp:
                    cnt = tmp
                    tmp =0

        if max(cnt,tmp) < 3:
                return raise(NameError)
        if result =='Yes':
            for i in range(a,c-1):
                if s[i]=='#'and s[i+1]=='#':
                    result='No'
    else:
        for i in range(b,d-1):
            if s[i] =='#' and s[i+1]=='#':
                result ='No'
                break
        if result=='Yes':
            for i in range(a,c-1):
                if s[i] =='#' and s[i+1]=='#':
                    result = 'No'
    print(result)

main()

### FIXED CODE ###

n, a, b, c, d = map(int, input().split(' '))
s = input()
def rock(a,b):
    tmp = 0
    result = 1
    for i in s[a:b]:
        if tmp==2:
            result = 0
            break
        if i =='#':
            tmp +=1
        else:
            tmp=0
    return result
def main():
    result =0
    if c<d:
        result = min(rock(a,c-1),rock(b,d-1))
    else:
        result = min(rock(a,c-1),rock(b,d-1))
        if result ==1:
            result = 0
            for i in range(b-1,d):
                if s[i-1]=='.' and s[i]=='.' and s[i+1]=='.':
                    result = 1
    if result ==0:
        print('No')
    else:
        print('Yes')

main()
#d
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = [0] * Q
C = [0] * Q
for i in range(Q):
    B[i], C[i] = map(int, input().split())
D = [0] * (10**4)
ans=sum(A)
for i in A:
    D[i]+=1
for x in range(Q):
    D[C[x]]+=D[B[x]]
    tmp=D[B[x]]
    ans=ans+tmp*(C[x]-B[x])
    print(ans)
    D[B[x]]=0

### FIXED CODE ###

#d
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = [0] * Q
C = [0] * Q
for i in range(Q):
    B[i], C[i] = map(int, input().split())
D = [0] * (10**5+1)
ans=sum(A)
for i in A:
    D[i]+=1
for x in range(Q):
    ans+=D[B[x]]*int(C[x]-B[x])
    print(ans)
    D[C[x]]+=D[B[x]]
    D[B[x]]=0
H,N=map(int,input().split())
A=list(map(int,input().split()))
if H<=sum(a):
  print('Yes')
else:
  print('No')

### FIXED CODE ###

H,N=map(int,input().split())
A=list(map(int,input().split()))
if H<=sum(A):
  print('Yes')
else:
  print('No')
A, B, N = map(int, input().split())

total_price = A + (N * B)

print(total_price - max(total_price))


### FIXED CODE ###

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

# N人*A円がB円より大きい場合
if N * A > B:
    print(B)
else:
    print(N * A)
import sys
import math
import queue
import copy
import bisect#2分探索
from collections import deque #popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意

def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s): return sorted(range(len(s)), key=lambda k: s[k])

#mod = 10**9+7

S = int(input())
#N, K = map(int, input().split())
#L = [int(input()) for i in range(N)]
#A = list(map(int, input().split()))
#S = [inputl() for i in range(H)]
#q = queue.Queue() #q.put(i) #q.get() 
#q = queue.LifoQueue() #q.put(i) #q.get() 

#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b=copy.deepcopy(a)  #2次元配列はこうコピーする
#w.sort(key=lambda x:x[1],reverse=True)  #二個目の要素で降順並び替え

#素数リスト
# n = 100
# primes = set(range(2, n+1))
# for i in range(2, int(n**0.5+1)):
#     primes.difference_update(range(i*2, n+1, i))
# primes=list(primes)

#bisect.bisect_left(a, 4)#aはソート済みである必要あり。aの中から4未満の位置を返す。rightだと以下
#bisect.insort_left(a, 4)#挿入

ss=str(S)
# #print(ss)
ls=len(ss)
# l=[0]*(ls+1)

    #print(l[i])
#print(l)

import heapq #優先度付きqueue

kl=dict()
kl[0]=1
# a = [0]
# heapq.heapify(a)  # aを優先度付きキューに

for i in range(0,ls):
    tmp=(S%10**(i+1))%2019
    kl[tmp]=kl.get(tmp,0)+1
#print(a)


ans=0

for k in kl:
    val=kl[k]
    ans+=val*(val-1)//2

print(ans)
# cur=-1
# ans=0
# for i, li in enumerate(l):
#     if cur==-1:
#         cur=li
#         count=1
#     elif li==cur:
#         count+=1
#     else:
#         ans+=count*(count-1)//2
#         cur=li
#         count=1

# print(ans)

### FIXED CODE ###

import sys
import math
import queue
import copy
import bisect#2分探索
from collections import deque #popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意

def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s): return sorted(range(len(s)), key=lambda k: s[k])

#mod = 10**9+7

#N = int(input())
S,W = map(int, input().split())
#L = [int(input()) for i in range(N)]
#A = list(map(int, input().split()))
#S = [inputl() for i in range(H)]
#q = queue.Queue() #q.put(i) #q.get() 
#q = queue.LifoQueue() #q.put(i) #q.get() 

#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b=copy.deepcopy(a)  #2次元配列はこうコピーする
#w.sort(key=lambda x:x[1],reverse=True)  #二個目の要素で降順並び替え

#素数リスト
# n = 100
# primes = set(range(2, n+1))
# for i in range(2, int(n**0.5+1)):
#     primes.difference_update(range(i*2, n+1, i))
# primes=list(primes)

#bisect.bisect_left(a, 4)#aはソート済みである必要あり。aの中から4未満の位置を返す。rightだと以下
#bisect.insort_left(a, 4)#挿入

if S<=W:
    print('unsafe')
else:
    print('safe')
import math
N,X = map(int,input().split())
x = list(map(int,input().split()))
x.append(X)
x.sort()
ans = x[1]-x[0]
for i in range(N):
    ans = math.gcd(ans,x[i+1]-x[i])
print(ans)


### FIXED CODE ###

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a
N,X = map(int,input().split())
x = list(map(int,input().split()))
x.append(X)
x.sort()
ans = x[1]-x[0]
for i in range(N):
    ans = gcd(ans,x[i+1]-x[i])
print(ans)
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
MOD = int(1e9) + 7

stair = []
for i in range(N):
    if i+1 in a:
        stair.append(False)
    else:
        stair.append(True)

# DP
dp = [0] * N
if stair[0]:
    dp[0] = 1
if stair[1]:
    dp[1] = dp[0] + 1
else:
    dp[1] = 0

for i in range(2, N):
    if not stair[i]:
        dp[i] = 0
        continue
    if stair[i-1] and stair[i-2]:
        dp[i] = dp[i-1] + dp[i-2]
    elif stair[i-1]:
        dp[i] = dp[i-1]
    elif stair[i-2]:
        dp[i] = dp[i-2]
        
print(dp[N-1] % MOD)

### FIXED CODE ###

import sys

n, m = map(int, input().split())
aaa = set()
if m != 0:
    for _ in range(m):
        aaa.add(int(input()))
    
    
dp = [0] * (n + 1) # 0 array
dp[0] = 1
dp[1] = 1 if 1 not in aaa else 0 # 入ってはいけない段に1が存在した場合は0
MOD = int(1e9) + 7

for i in range(2, n + 1):
    if i in aaa:
        continue
    dp[i] = (dp[i-2] + dp[i-1]) % MOD # 入ってはいけないところからの遷移の場合0を加算
print(dp[n])
n = int(inout())
p = list(map(int, input().split()))

l = int(a/2)

for i in range(l-1):
    t1 = max(p)
    t2 = min(p)
    #print(t1, t2)
    p.remove(t1)
    p.remove(t2)

print(max(p) - min(p))

### FIXED CODE ###

from heapq import nsmallest

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

m = int(-(n/2))
s = int(n/2)

m2 = sorted(p)[m]
s2 = nsmallest(s, p)[-1]

print(m2-s2)
patterns = []
for i in range(2**(l-1)):
    pattern = [''] * (l-1)
    for j in range(l-1):
        if (i >> j & 1):
            pattern[j] = '+'
    patterns.append(pattern)

ans = 0
for pattern in patterns:
    a = s[0]
    for i in range(l-1):
        if (pattern[i] == ''):
            a += s[i+1]
        else:
            ans += int(a)
            a = s[i+1]
    else:
        ans += int(a)

print(ans)

### FIXED CODE ###

s = input()
l = len(s)

patterns = []
for i in range(2**(l-1)):
    pattern = [''] * (l-1)
    for j in range(l-1):
        if (i >> j & 1):
            pattern[j] = '+'
    patterns.append(pattern)

ans = 0
for pattern in patterns:
    a = s[0]
    for i in range(l-1):
        if (pattern[i] == ''):
            a += s[i+1]
        else:
            ans += int(a)
            a = s[i+1]
    else:
        ans += int(a)

print(ans)
N,K,Q = map(int,input().split())
ANS = [0] * N
A = [int(input()) for _ in range(Q)]
for a in A:
  ANS[a-1] += 1
  
R = []
for i in range(N):
  p = K - Q + ANS[i]
  if p <= 0:
    R.append('No')
  else:
	R.append('Yes')
    
print('\n'.join(R))


### FIXED CODE ###

N,K,Q = map(int,input().split())
ANS = [0] * N
A = [int(input()) for _ in range(Q)]
for a in A:
  ANS[a-1] += 1
  
for i in range(N):
  p = K - Q + ANS[i]
  if p <= 0:
    print('No')
  else:
    print('Yes')
    
exit()
S = input()

mod = 10**9+7
N = len(S)
ans = 0

memo = {}
for i in range(1000):
    s = str(i).zfill(3)
    memo[s] = [0 for _ in [0]*13]
    memo[s][i%13] = 1

def rep_Q_count(s):
    memo[s] = [0 for _ in [0]*13]
    for q in range(10):
        s2 = s.replace("?",str(q),1)
        for i,n in enumerate(memo[s2]):
            memo[s][i] += n

for i in range(100):
    s = str(i).zfill(2)
    rep_Q_count(s+"?")
    rep_Q_count(s[0]+"?"+s[1])
    rep_Q_count("?"+s)
for i in range(10):
    s = str(i)
    rep_Q_count(s+"??")
    rep_Q_count("?"+s+"?")
    rep_Q_count("??"+s)
rep_Q_count("???")

s0 = S[N-3:N]
dp = memo[s0][:]
for i in range(1,(N-1)//3+1):
    s = S[max(0,N-(i+1)*3):N-i*3]
    j = i%2
    tmp = memo[s]
    dp2 = [0]*13
    for k,n in enumerate(tmp):
        for l,m in enumerate(dp):
            dp2[(l+k*((-1)**j))%13] += n*m
    dp = dp2
    for i in range(13):
        dp[i] %= mod
print(dp[5])

### FIXED CODE ###

S = input()

mod = 10**9+7
N = len(S)
ans = 0

memo = {}
for i in range(1000):
    s = str(i).zfill(3)
    memo[s] = [0 for _ in [0]*13]
    memo[s][i%13] = 1

def rep_Q_count(s):
    memo[s] = [0 for _ in [0]*13]
    for q in range(10):
        s2 = s.replace("?",str(q),1)
        for i,n in enumerate(memo[s2]):
            memo[s][i] += n

for i in range(100):
    s = str(i).zfill(2)
    rep_Q_count(s+"?")
    rep_Q_count(s[0]+"?"+s[1])
    rep_Q_count("?"+s)
for i in range(10):
    s = str(i)
    rep_Q_count(s+"??")
    rep_Q_count("?"+s+"?")
    rep_Q_count("??"+s)
rep_Q_count("???")

s0 = S[max(0,N-3):N].zfill(3)
dp = memo[s0][:]
for i in range(1,(N-1)//3+1):
    s = S[max(0,N-(i+1)*3):N-i*3].zfill(3)
    j = i%2
    tmp = memo[s]
    dp2 = [0]*13
    for k,n in enumerate(tmp):
        for l,m in enumerate(dp):
            dp2[(l+k*((-1)**j))%13] += n*m
    dp = dp2
    for i in range(13):
        dp[i] %= mod
print(dp[5])
def solve(n, m, h, a, b):
    for j in range(m):
        a[j] -= 1
        b[j] -= 1
    parents = [i for i in range(n)]
    def root(x):
        return x if parents[x] == x else root(parents[x])

    for a_j, b_j in zip(a, b):
        ra, rb = root(a_j), root(b_j)
        if ra != rb:
            if ra > rb:
                a_j, b_j = b_j, a_j
            parents[ra] = rb

    D = {}
    for j, pj in enumerate(parents):
        if not pj in D:
            D[pj] = []
        D[pj].append(h[j])
    ans = 0
    for k, v in D.items():
        if len(v) == 1:
            ans += 1
        else:
            v = sorted(v)
            ans += int(v[-1] > v[-2])
    return ans

n, m = map(int, input().split())
h = list(map(int, input().split()))
a = [0] * m
b = [0] * m
for j in range(m):
    a[j], b[j] = map(int, input().split())
print(solve(n,m, h, a, b))


### FIXED CODE ###

def solve(n, m, h, a, b):
    for j in range(m):
        a[j] -= 1
        b[j] -= 1
    E = {i:[] for i in range(n)}
    for x, y in zip(a, b):
        E[x].append(y)
        E[y].append(x)
    ans = 0
    for i in range(n):
        ok = True
        for j in E[i]:
            if h[i] <= h[j]:
                ok = False
        ans += ok
    return ans
n, m = map(int, input().split())
h = list(map(int, input().split()))
a = [0] * m
b = [0] * m
for j in range(m):
    a[j], b[j] = map(int, input().split())
print(solve(n,m, h, a, b))
a,b=mpa(int,input().split())
print('Possible' if (a%3==0 or b%3==0 or a+b%3==0) else 'Impossible')

### FIXED CODE ###

a,b=map(int,input().split())
print('Possible' if (a%3==0 or b%3==0 or (a+b)%3==0) else 'Impossible')
class board:
    def __init__(self, h, w):
        self.h = h
        self.w = w
        self.pieces = self.make_pieces()
        self.results = dict()

    def make_pieces(self):
        pieces = []
        for i in range(self.h):
            for j in range(self.w):
                pieces.append(0)
        return pieces

    def draw(self, i, j):
        i -= 1; j-= 1

        index = j + i * self.w
        print(index)
        self.pieces[index] = 1

    def start_scan(self):
        for i in range(self.w - 2):
            print(i)
            for j in range(self.h - 2):
                print(j)
                num = 0
                for x in range(i, i+3):
                    for y in range(j, j+3):
                        index = x + y * self.w
                        v = self.pieces[index]
                        print("v = {0}".format(v))
                        if v == 1:
                            num += 1
                self.results[num] = num

    def searched_box(self, num):
        return self.results.get(num, 0)
        

if __name__ == '__main__':
    args = input().split(' ')
    board_h = int(args[0])
    board_w = int(args[1])
    n       = int(args[2])

    board = board(board_h, board_w)
    for _ in range(n):
        args = input().split(' ')
        i = int(args[0])
        j = int(args[1])
        board.draw(i, j)

    board.start_scan()
    for i in range(10):
        print(board.searched_box(i))


### FIXED CODE ###

a = int(input())
b = int(input())
h = int(input())

s = ((a + b) * h ) / 2
print(int(s))
# coding: utf-8
S=list(input())
T=list(input())

S.reverse()
T.reverse()

for i in range(len(S)-len(T)):
    flg=True
    for j in range(len(T)):
        if not(S[i+j]=="?"):
            if S[i+j]!=T[j]:
                flg=False
    if flg:
        for k in range(len(T)):
            S[i+k]=T[k]
        break    
        

S.reverse()

for i in range(len(S)):
    if S[i]=="?":
        S[i]="a"
if flg:
    print("".join(S))
else:
    print("UNRESTORABLE")



### FIXED CODE ###

# coding: utf-8
S=list(input())
T=list(input())
flg=False
S.reverse()
T.reverse()

for i in range(max(0,len(S)-len(T)+1)):
    flg=True
    for j in range(len(T)):
        if not(S[i+j]=="?"):
            if S[i+j]!=T[j]:
                flg=False
    if flg:
        for k in range(len(T)):
            S[i+k]=T[k]
        break    
        

S.reverse()

for i in range(len(S)):
    if S[i]=="?":
        S[i]="a"
if flg:
    print("".join(S))
else:
    print("UNRESTORABLE")
a,b = map(float,input().split())
print(a//b)


### FIXED CODE ###

from decimal import Decimal
a,b = map(Decimal,input().split())
print(int(a*b))
A = int(input())
B = int(input())
C = int(input())
X = int(input())
res = 0
for a500 in range(A + 1):
    for b100 in range(B + 1):
        for c50 in range(C + 1):
            if a500 * 500 + b100 * 100 + c50 * 50 = X:
                res += 1
print(res)

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
X = int(input())
res = 0
for a500 in range(A + 1):
    for b100 in range(B + 1):
        for c50 in range(C + 1):
            if a500 * 500 + b100 * 100 + c50 * 50 == X:
                res += 1
print(res)
# ABC128-B
# ソートが大事な問題
import itemgetter
a = int(input())
book = []
for i in range(a):
    array = input().split()
    book.append((array[0], int(array[1]) * -1, i))

ans = sorted(book, key=itemgetter(0, 1))

for i in range(a):
    print(ans[i][2] + 1)


### FIXED CODE ###

from operator import itemgetter

# a, b = map(int, input().split())
a = int(input())
array2 = {}
array99 = []
for i in range(a):
    array = input().split()
    array99.append((array[0], int(array[1]) * -1, i))

# print(array99)

b = sorted(array99, key=itemgetter(0, 1))

# print(b)

for i in range(a):
    print(b[i][2] + 1)
r = int(input())

s = r*r*math.pi
l = 2*r*math.pi

print(str(s) + " " + str(l))

### FIXED CODE ###

r = float(input())

s = r * r * 3.14159265358979
l = 2 * r * 3.14159265358979
 
print(s, end = " ")
print(l)
s=input()
k=int(input())

for i in range(len(s)):
    if s[i]!="1":
        nextone=s[i]
        break
    
if i>=k:
    print(1)
else:
    print(nextone)

### FIXED CODE ###

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

for i in range(len(s)):
    if s[i]!="1":
        nextone=s[i]
        break
if s.count("1")==len(s):
    print(1)
elif i>=k:
    print(1)
else:
    print(nextone)
if sorted(map(int, input().split())) == [5, 5, 7]:
  return 'Yes'
else:
  return 'No'
  

### FIXED CODE ###

L = sorted(map(int, input().split()))
 
ans = 'YES' if L == [5, 5, 7] else 'NO'
print(ans)
N = int(input())
    A = [int(i) for i in input().split(" ")]
def bubble(A, N):
    count = 0
    flag = True
    while flag == True:
        flag = False
        for j in range(N-1, 0, -1):
            if A[j] < A[j - 1]:
                A[j -1],A[j] = A[j], A[j - 1]
                count += 1
                flag = True
        print(" ".join(map(str, A)))
        print(count)
print(bubble(A,N))

### FIXED CODE ###

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


def bubble_sort(A, N):
    cnt = 0
    flag = True
    while(flag):
        flag = False
        for i in range(N-1, 0, -1):
            if(A[i-1] > A[i]):
                A[i-1], A[i] = A[i], A[i-1]
                cnt += 1
                flag = True

    print(" ".join(list(map(str, A))))
    print(cnt)

bubble_sort(A, N)
n,a,b=map(int,input().split())
ans=n/(a+b)
 if n%(a+b)>=a:
    ans+=a
 else:
    ans+=n%(a+b)
print(ans)

### FIXED CODE ###

n,a,b=map(int,input().split())
ans=int(n/(a+b))*a
if n%(a+b)>=a:
    ans+=a
else:
    ans+=n%(a+b)
print(ans)
n = input()
k=0
for i in range(10):
  if n.count(i)>=3:
    print("Yes")
    k=1
  break
if k=0:
  print("No")
  
   

### FIXED CODE ###

n = input()
if n[0]==n[1] and n[1]==n[2]:
  print("Yes")
elif n[1]==n[2] and n[2]==n[3]:
  print("Yes")
else:
  print("No")
x,y,z= list(map(int, input().split()))
if y>=z:
    print("delicious")
else:
    print("safe" if x+a>=b else "dangerous")


### FIXED CODE ###

x,y,z= list(map(int, input().split()))
if y>=z:
    print("delicious")
else:
    print("safe" if x+y>=z else "dangerous")
n = input()
d = set()
pre = ""
for i in range(n):
    s = raw_input()
    if s in d:
        print "No"
        exit()
    if pre == "" or pre[-1] == s[0]:
        d.add(s)
        pre = d
    else:
        print "No"
        exit()
print "Yes"

### FIXED CODE ###

n = input()
d = set()
pre = ""
for i in range(n):
    s = raw_input()
    if s in d:
        print "No"
        exit()
    if pre == "" or pre[-1] == s[0]:
        d.add(s)
        pre = s
    else:
        print "No"
        exit()
print "Yes"
if S == "AAA" or S == "BBB":
    print("NO")
else:
    print("YES")

### FIXED CODE ###

S = input()
if len(set(S)) != 2:
  print("No")
else:
  print("Yes")
import sys
sys.setrecursionlimit(10000)

h, w = map(int, input().split())
a = [input() for _ in range(h)]
mod = 10**9+7

dp = [[0 for _ in range(h+1)] for _ in range(w+1)]
dp[0][0] = 1

for i in range(h):
    for j in range(w):
        if (i+1 < h) and (a[i+1][j] == '.'):
            dp[i+1][j] += dp[i][j]
            dp[i+1][j] %= mod
        if (j+1 < w) and (a[i][j+1] == '.'):
            dp[i][j+1] += dp[i][j]
            dp[i][j+1] %= mod

print(dp[h-1][w-1])

### FIXED CODE ###

h, w = map(int, input().split())
a = [input() for _ in range(h)]
mod = 10**9+7

dp = [[0 for _ in range(w+1)] for _ in range(h+1)]
dp[0][0] = 1

for i in range(h):
    for j in range(w):
        if i+1 < h and a[i+1][j] == '.':
            dp[i+1][j] += dp[i][j]
            dp[i+1][j] %= mod
        if j+1 < w and a[i][j+1] == '.':
            dp[i][j+1] += dp[i][j]
            dp[i][j+1] %= mod

print(dp[h-1][w-1])
x, op, y = input().split()
x = int(x)
y = int(y)
while not (x == 0 and y == 0 and op == "?") :
 if op == "+" :
  print(x + y)
 elif op == "-":
  print(x - y)
 elif op == "*":
  print(x * y)
 elif op == "/":
  print(x // y)
 x, op, y = input().split()
 x = int(x)
 y = int(y)

### FIXED CODE ###

x, op, y = input().split()
x = int(x)
y = int(y)
while op != "?" :
 if op == "+" :
  print(x + y)
 elif op == "-":
  print(x - y)
 elif op == "*":
  print(x * y)
 elif op == "/":
  print(x // y)
 x, op, y = input().split()
 x = int(x)
 y = int(y)
A = int(input())
B = int(input())
C = int(input())

A,B = B,C
A,C = C,A

print(A,B,C)

### FIXED CODE ###

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

A,C = C,A
print(A,B,C)
s = input()
n == 0
for i in 4:
    if s[i-1] == '+':
        n += 1
    else:
        n -= 1
print(n)      

### FIXED CODE ###

s = input()
n = s.count('+')
print(2*n - 4)
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
        if X == 500 * a + 100 * b + 50 * c:
            count = count + 1
print(count)

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            if X == 500 * a + 100 * b + 50 * c:
                count = count + 1
print(count)
a,b=map(int,input(),split())
x=(a+b)/2
if (a+b)%2==0:
  print(int(x))
else:
  print(int(x)+1)

### FIXED CODE ###

a,b=map(int,input().split())
x=(a+b)/2
if (a+b)%2==0:
  print(int(x))
else:
  print(int(x)+1)
a, b = map(int, input().split())
print(a // b, a % b, {:.10f}.format(a / b))


### FIXED CODE ###

a, b = map(int, input().split())
print(a // b, a % b, "{:.10f}".format(a / b))