Harryxun/stf_run huggingface dataset:
n=int(input())
w=[input() for i in range(n)]
flag=True
for s in w:
    if w.count(s) > 1:
        flag = False
for i in range(1,n)
    if list(w[i])[0] != reversed(list(w[i-1]))[0]:
        flag = False
print("Yes" if flag else "No")

### FIXED CODE ###

n=int(input())
w=[input() for i in range(n)]
flag=True
for s in w:
    if w.count(s) > 1:
        flag = False
for i in range(1,n):
    if w[i][0] != w[i-1][-1]:
        flag = False
print("Yes" if flag else "No")
#!/usr/bin/env python
while 1:
    try:
        n=int(raw_input())
        if n==0: break
        h1=map(int, raw_input().split())
        for h in h1:
            h2=[ x for x in h1 if x!=h ]
            g=[ h2[i+1]-h2[i] for i in range(n-1) ]
            if len(set(g))==1:
                print h
                break
    except RuntimeError, e:
        print e.message

### FIXED CODE ###

#!/usr/bin/env python
while 1:
    n=int(raw_input())
    if n==0: break
    grass=map(int, raw_input().split())
    for i in range(n+1):
        h=[ x for j,x in enumerate(grass) if i!=j ]
        g=[ h[j+1]-h[j] for j in range(len(h)-1) ]
        if len(set(g))==1:
            print grass[i]
            break
N,M,K = map(int,input().split())

par = [i for i in range(N+1)]

# 木の根を求める
def root(x):
    if par[x] == x:
        return x
    else:
        par[x] = root(par[x])
        return par[x]

# xとyが同じ集合に属するか否か
def bool_same(x,y):
    return root(x) == root(y)

# xとyの属する集合を併合
def unite(x,y):
    x = root(x)
    y = root(y)
    if x != y:
        par[x] = y

AB = [list(map(int,input().split())) for i in range(M)]
CD = [list(map(int,input().split())) for i in range(K)]

for a,b in AB:
    unite(a,b)

for i in range(N+1):
    root(i)

member = [0 for i in range(N+1)]

for p in par:
    member[p] += 1

ans = [member[par[i]]-1 for i in range(N+1)]

for a,b in AB:
    if bool_same(a,b):
        ans[a] -= 1
        ans[b] -= 1
for c,d in CD:
    if bool_same(c,d):
        ans[c] -= 1
        ans[d] -= 1
print(' '.join(map(str,ans[1:])))



### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

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

par = [i for i in range(N+1)]

# 木の根を求める
def root(x):
    if par[x] == x:
        return x
    else:
        par[x] = root(par[x])
        return par[x]

# xとyが同じ集合に属するか否か
def bool_same(x,y):
    return root(x) == root(y)

# xとyの属する集合を併合
def unite(x,y):
    x = root(x)
    y = root(y)
    if x != y:
        par[x] = y

AB = [list(map(int,input().split())) for i in range(M)]
CD = [list(map(int,input().split())) for i in range(K)]

for i in range(M):
    a,b = AB[i]
    unite(a,b)

member = [0 for i in range(N+1)]

for i in range(1,N+1):
    member[root(i)] += 1

ans = [member[par[i]]-1 for i in range(N+1)]

for i in range(M):
    a,b = AB[i]
    if bool_same(a,b):
        ans[a] -= 1
        ans[b] -= 1

for i in range(K):
    c,d = CD[i]
    if bool_same(c,d):
        ans[c] -= 1
        ans[d] -= 1

print(*ans[1:])
def primeFactor(n):
    res = {}
    i = 2
    while i*i <= n:
        while n % i == 0:
            key = str(i)
            res.update({key : 1+int(res.get(key,0))})
            n=n/i
        i=i+1    
    if n!=1:
        key = str(n)
        res.update({key : 1+int(res.get(key,0))})
    return res

N, P = map(int, input().split())
max = 1
for divisor, count in primeFactor(P).items():
    while count >= N:
        max *= int(divisor)
        count -= N
print(max)


### FIXED CODE ###

def primeFactor(n):
    res = {}
    i = 2
    while i*i <= n:
        while n % i == 0:
            key = str(i)
            res.update({key : 1+int(res.get(key,0))})
            n=n//i
        i=i+1    
    if n!=1:
        key = str(n)
        res.update({key : 1+int(res.get(key,0))})
    return res

N, P = map(int, input().split())
max = 1
for divisor, count in primeFactor(P).items():
    while count >= N:
        max *= int(divisor)
        count -= N
print(max)
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
ans = 0
for i in range(0,N) :
    A = list(int,input().split())
    Sum = C
    for (x,y) in zip(A,B):
        Sum += (x*y)
    if Sum > 0 :
        ans += 1
print(ans)

### FIXED CODE ###

N,M,C = map(int,input().split())
B = list(map(int,input().split()))
ans = 0
for i in range(0,N) :
    A = list(map(int,input().split()))
    Sum = C
    for (x,y) in zip(A,B):
        Sum += (x*y)
    if Sum > 0 :
        ans += 1
print(ans)
a,b = map(int,input().split)
if a < b:
    print("a < b")
elif a > b:
    print("a > b")
else:
    print("a == b")

### FIXED CODE ###

a,b=map(int,input().split())
if a < b:
    print("a < b")
elif a > b:
    print("a > b")
else:
    print("a == b")
n =int(input())
a =[int(input()) for i in range(n)]

dict = {}
for i in range(n):
  if not(a[i] in dict):
    dict(a[i]) =1
  if s[i] in dict:
    dict.pop(a[i])
    
print(len(dict))
  


### FIXED CODE ###

n = int(input())
d = {}
for i in range(n):
    a = int(input())
    if a in d:
        del d[a]
    else:
        d[a] = 1
print(len(d))
while 1:
 n,x=map(int,input().split())
 if n+x==0:break
 print(sum([1 for j in range(2,x-i)for i in range(3,n+1)if x-i-j<j<i]))

### FIXED CODE ###

from itertools import combinations
while 1:
 n,m=map(int,input().split())
 if n==m==0:break
 print(sum(1 for p in combinations(range(1,n+1),3)if sum(p)==m))
n, k = map(int, input().split())
s = input()
if s.count("1") == n or s.count("0") == n:
    print(n)
    exit()
renzoku = []
count = 0
flag = 0
for i in range(n):
    if s[i] == "1":
        if flag:
            count += 1
        else:
            renzoku.append(count)
            count = 1
        flag = 1
    else:
        if flag:
            renzoku.append(count)
            count = 1
        else:
            count += 1
        flag = 0
renzoku.append(count)
renzoku_t = [0]
for i in range(len(renzoku)):
    renzoku_t.append(renzoku[i] + renzoku_t[i])
ans = 0
if s[0] == "0":
    ans = renzoku_t[0 + k + k] - renzoku_t[0]
for i in range(1, len(renzoku) - k - k + 1, 2):
    if i == 0 or i == len(renzoku) - k - k:
        ans = max(ans, renzoku_t[i + k + k] - renzoku_t[i])
    else:
        ans = max(ans, renzoku_t[i + k + k + 1] - renzoku_t[i])
print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
s = input()
if s.count("1") == n or s.count("0") == n:
    print(n)
    exit()
zero = 0
flag = 0
for i in s:
    if i == "0":
        flag = 1
    else:
        if flag:
            zero += 1
        flag = 0
if flag:
    zero += 1
k = min(zero, k)
renzoku = []
count = 0
flag = 0
for i in range(n):
    if s[i] == "1":
        if flag:
            count += 1
        else:
            renzoku.append(count)
            count = 1
        flag = 1
    else:
        if flag:
            renzoku.append(count)
            count = 1
        else:
            count += 1
        flag = 0
renzoku.append(count)
renzoku_t = [0]
for i in range(len(renzoku)):
    renzoku_t.append(renzoku[i] + renzoku_t[i])
ans = 0
if k == zero:
    print(n)
    exit()
if s[0] == "0":
    ans = renzoku_t[0 + k + k] - renzoku_t[0]
for i in range(1, len(renzoku) - k - k + 1, 2):
    if i == 0 or i == len(renzoku) - k - k:
        ans = max(ans, renzoku_t[i + k + k] - renzoku_t[i])
    else:
        ans = max(ans, renzoku_t[i + k + k + 1] - renzoku_t[i])
print(ans)
from sys import stdin


def dfs(g, seen, n, ans):
    all_seen = True

    for si in seen:
        if si == False:
            all_seen = False

    if all_seen:
        ans += 1
        return ans

    for m in g[n]:
        if seen[m]:
            continue

        seen[m] = True
        ans = dfs(g, seen, m, ans)
        seen[m] = False

    return ans


def main():
    n, m = map(int, stdin.readline().split())
    ab = [map(int, stdin.readline().split()) for _ in range(n)]
    g = [[] for _ in range(n)]
    for abi in ab:
        a, b = abi
        g[a - 1].append(b - 1)
        g[b - 1].append(a - 1)
    seen = [False for _ in range(n)]
    seen[0] = True

    ans = 0

    ans = dfs(g, seen, 0, ans)

    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from sys import stdin


def dfs(g, seen, n):
    all_seen = True

    for si in seen:
        if si == False:
            all_seen = False

    if all_seen:
        return 1

    ans = 0

    for m in g[n]:
        if seen[m]:
            continue

        seen[m] = True
        ans += dfs(g, seen, m)
        seen[m] = False

    return ans


def main():
    n, m = map(int, stdin.readline().split())
    ab = [map(int, stdin.readline().split()) for _ in range(m)]
    g = [[] for _ in range(n)]
    for abi in ab:
        a, b = abi
        g[a - 1].append(b - 1)
        g[b - 1].append(a - 1)
    seen = [False for _ in range(n)]
    seen[0] = True

    ans = dfs(g, seen, 0)

    print(ans)


if __name__ == "__main__":
    main()
import math
import copy
H,N=map(int,input().split())

dp=[0]+[None]*H

for i in range(N):
    A,B=map(int,input().split())
    ndp=[0]+[None]*H
    for j in range(A,H+1):
        if dp[j]==None:
            if ndp[j-A]!=None:
                ndp[j]=ndp[j-A]+B
            continue
        
        if ndp[j-A]==None:
            if dp[j]!=None:
                ndp[j]=dp[j]
            
            continue

        ndp[j]=min(ndp[j-A]+B,dp[j])

    for j in range(max(H-A+1,0),H+1):
        if ndp[j]==None:
            continue

        if ndp[-1]!=None:
            ndp[-1]=min(ndp[j]+B,ndp[-1])
        else:
            ndp[-1]=ndp[j]+B
    
    if A >= H:
        ndp[-1]=min(B,dp[-1])

    dp=ndp

print(dp[-1])

### FIXED CODE ###

import math

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

    inf=float('inf')
    dp=[0]+[inf]*H

    for i in range(N):
        A,B=map(int,input().split())
        if A>=H:
            #dp[-1]=min(B,dp[-1])
            if B < dp[-1]:
                dp[-1]=B
        else:
            for j in range(A,H+1):
                #dp[j]=min(dp[j-A]+B,dp[j])
                if dp[j-A]+B<dp[j]:
                    dp[j]=dp[j-A]+B

                if j > H-A:
                    #dp[-1]=min(dp[-1],dp[j]+B)
                    if dp[j]+B < dp[-1]:
                        dp[-1]=dp[j]+B

    print(dp[-1])

main()
, B, C, K = map(int, input().split())
print(max(K, A)+min(0, K-A-B))

### FIXED CODE ###

A, B, C, K = map(int, input().split())
print(min(K, A)-max(0, K-A-B))
N = int(input())
S = input()

East = [0] * N
West = [0] * N

for i,s in enumerate(list(S)):
    if s == 'W' : 
        if i==0:
            East[i] = 1
        else:
            East[i] = East[i-1] + 1
    else:
        East[i] = East[i-1]
i = N-1
for s in reversed((list(S))):
    if s == 'E' : 
        if i==N-1:
            West[i] = 1
        else:
            West[i] = West[i+1] + 1
    else:
        West[i] = West[i+1]
    i -= 1
            
ans = 2**31-1

for i in range(N):
    if i == 1:
        ans2 = West[1]
    elif i == N-1:
        ans2 = East[N-2]
    else:
        ans2 = East[i-1]+West[i+1]
    ans = min(ans,ans2)
    
print(ans)
    

### FIXED CODE ###

N = int(input())
S = input()

East = [0] * N
West = [0] * N

for i,s in enumerate(list(S)):
    if s == 'W' : 
        if i==0:
            East[i] = 1
        else:
            East[i] = East[i-1] + 1
    else:
        if i == 0:
            East[i] = 0
        else:
            East[i] = East[i-1]
i = N-1
for s in reversed((list(S))):
    if s == 'E' : 
        if i==N-1:
            West[i] = 1
        else:
            West[i] = West[i+1] + 1
    else:
        if i == N-1:
            West[i] = 0
        else:
            West[i] = West[i+1]
    i -= 1
            
ans = 2**31-1

for i in range(N):
    if i == 1:
        ans2 = West[1]
    elif i == N-1:
        ans2 = East[N-2]
    else:
        ans2 = East[i-1]+West[i+1]
    ans = min(ans,ans2)
    
print(ans)
def main():
    import sys
    input=sys.stdin.readline
    s=input()
    alpha="abcdefghijklmnopqrstuvwxyz"
    l=len(s)
    alpha2={j:i for i,j in enumerate(alpha)}
    memo=[[0]*26 for _ in range(l,-1,-1)]
    for i in range(26):
        memo[l][i]=l+1
    for i in range(l-1,-1,-1):
        for x,y in alpha2.items():
            memo[i][y]=memo[i+1][y]
        memo[i][alpha2[s[i]]]=i+1

    search=[1]*(l+2)
    search[l+1]=0
    for i in range(l-1,-1,-1):
        m=max([memo[i][j] for j in range(26)])
        if m!=l+1:
            search[i]=search[m]+1
    
    n,seq=0,0
    ans_len=search[0]
    ans=""
    temp=0
    for i in range(ans_len):
        for j in range(26):
            n=memo[temp][j]
            seq=search[n]+i
            if seq+1==ans_len:
                ans+=alpha[j]
                temp=memo[temp][j]
                break
    print(ans)
if __name__=='__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    input=sys.stdin.readline
    s=input()
    alpha="abcdefghijklmnopqrstuvwxyz"
    l=len(s)
    alpha2={j:i for i,j in enumerate(alpha)}
    memo=[[0]*26 for _ in range(l,-1,-1)]
    for i in range(26):
        memo[l][i]=l+1
    for x,y in alpha2.items():
        for i in range(l-1,-1,-1):
            if s[i]==x:
                memo[i][y]=i+1
            else:
                memo[i][y]=memo[i+1][y]
    
    search=[1]*(l+2)
    search[l+1]=0
    for i in range(l-1,-1,-1):
        m=max([memo[i][j] for j in range(26)])
        if m!=l+1:
            search[i]=search[m]+1
    
    n,seq=0,0
    ans_len=search[0]
    ans=""
    temp=0
    for i in range(ans_len):
        for j in range(26):
            n=memo[temp][j]
            seq=search[n]+i
            if seq+1==ans_len:
                ans+=alpha[j]
                temp=memo[temp][j]
                break
    print(ans)
if __name__=='__main__':
    main()
h,w = map(int,input().split())
s = [input() for i in range(h)]

print("#" * w + 2)
for i in range(h):
    print("#" + s[i] + "#")
print("#" * w + 2)


### FIXED CODE ###


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

print("#"*(m+2))
for i in range(n):
  print("#"+s[i]+"#")
print("#"*(m+2))
n = int(input())

l = []
for _ in range(0, 100):
    x = _**5
    if x > 10**9:
        break
    else:
        l.append(x)
tmp = len(l)

for i in range(len(l)):
    l.append(l[i]*-1)

from itertools import combinations
y = (list(combinations(l, 2)))

for j in range(len(y)):
    if y[j][0] - y[j][1] == n:
        z = j

if y[z][0] >= 0:
    a = l.index(y[z][0])
else:
    a = -1 * (l.index(y[z][0]*-1))

if y[z][1] >= 0:
    b = l.index(y[z][1])
else:
    b = -1 * (l.index(y[z][1]*-1))

print(a, b)        
        

### FIXED CODE ###

# +の場合
i = 0
ans = 0
while ans <= 1000000000:
   i += 1
   ans = i**5 - (i-1)**5
# i: 120

# -の場合
i = 0
ans = 0
while ans <= 1000000000:
   i -= 1
   ans = i**5 - (i-1)**5 
# i: -119

n = int(input())
l = [_**5 for _ in range(120)]

for i in range(1,120):
    for j in range(120):
        if l[i] - l[j] == n:
            print(int(l[i]**0.2), int(l[j]**0.2))
            exit()
        if l[i] + l[j] == n:
            print(int(l[i]**0.2), int(-1*l[j]**0.2))
            exit()
#121-D
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
a,b=IL()
import math
if a==0:
    if b==0:
        n=0
    else:
        n=int(math.log(b,2))+1
else:
    if b==0:
        n=int(math.log(a,2))+1
    else:
        n=max(int(math.log(a,2)),int(math.log(b,2)))+1
al=[0 for i in range(n)]
bl=[0 for i in range(n)]
cl=[0 for i in range(n)]
for i in range(1,n):
    k=pow(2,i+1)
    al[i]=a%k
    bl[i]=b%k
    bou=k//2-1
    if al[i]<=bl[i]:
        if al[i]<=bou:
            if bl[i]<=bou:
                cl[i]=0
            else:
                cl[i]=0 if (bl[i]-bou)%2==0 else 1
        else:
            cl[i]=1 if (bl[i]-al[i])%2==0 else 0
    else:
        if bl[i]<=bou:
            if al[i]<=bou:
                cl[i]=0
            else:
                cl[i]=0 if (k-al[i])%2==0 else 1
        else:
            if al[i]<=bou:
                cl[i]=0 if (bl[i]-bou)%2==0 else 1
            else:
                cl[i]=0 if (k-al[i]+bl[i]-bou)%2==0 else 1
if a%2==0:
    if b%2==0:
        cl[0]=0 if ((b-a)//2)%2==0 else 1
    else:
        cl[0]=0 if (((b+1)-a)//2)%2==0 else 1
else:
    if b%2==1:
        cl[0]=1 if ((b-a)//2)%2==0 else 0
    else:
        cl[0]=1 if (((b-1)-a)//2)%2==0 else 0
        
ans=0
for i in range(n):
    ans+=cl[i]*pow(2,i)
print(ans)

### FIXED CODE ###

#121-D
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
a,b=IL()
import math
if a==0:
    if b==0:
        n=1
    else:
        n=int(math.log(b,2))+1
else:
    if b==0:
        n=int(math.log(a,2))+1
    else:
        n=max(int(math.log(a,2)),int(math.log(b,2)))+1
al=[0 for i in range(n)]
bl=[0 for i in range(n)]
cl=[0 for i in range(n)]
for i in range(1,n):
    k=pow(2,i+1)
    al[i]=a%k
    bl[i]=b%k
    bou=k//2-1
    if al[i]<=bl[i]:
        if al[i]<=bou:
            if bl[i]<=bou:
                cl[i]=0
            else:
                cl[i]=0 if (bl[i]-bou)%2==0 else 1
        else:
            cl[i]=1 if (bl[i]-al[i])%2==0 else 0
    else:
        if bl[i]<=bou:
            if al[i]<=bou:
                cl[i]=0
            else:
                cl[i]=0 if (k-al[i])%2==0 else 1
        else:
            if al[i]<=bou:
                cl[i]=0 if (bl[i]-bou)%2==0 else 1
            else:
                cl[i]=0 if (k-al[i]+bl[i]-bou)%2==0 else 1
if a%2==0:
    if b%2==0:
        cl[0]=0 if ((b-a)//2)%2==0 else 1
    else:
        cl[0]=0 if (((b+1)-a)//2)%2==0 else 1
else:
    if b%2==1:
        cl[0]=1 if ((b-a)//2)%2==0 else 0
    else:
        cl[0]=1 if (((b-1)-a)//2)%2==0 else 0
        
ans=0
for i in range(n):
    ans+=cl[i]*pow(2,i)
print(ans)
a,b=[],
for z in[*open(0)][1:]:x,y=map(int,z.split());a+=x+y,;b+=x-y,
print(max(abs(max(a)-min(a)),abs(max(b)-min(b))))

### FIXED CODE ###

n,*z=map(int,open(0).read().split())
a,b=[],[]
for x,y in zip(*[iter(z)]*2):
    a+=x+y,
    b+=x-y,
print(max(abs(max(a)-min(a)),abs(max(b)-min(b))))
a, b, c = map(int, raw_input().split())

if a < b and b < c:
 print yes
else
 print no

### FIXED CODE ###

a, b, c = map(int, raw_input().split())
  
if a < b and b < c:
 print "Yes"
else:
 print "No"
N = int(input())
S = list(input())
K = int(input())
for i in range(N):
  if S[i] != S[K]:
    S[i] = "*"
print("".join(S))

### FIXED CODE ###

N = int(input())
S = list(input())
K = int(input())
for i in range(N):
  if S[i] != S[K-1]:
    S[i] = "*"
print("".join(S))
from collections import Counter
import sys
n = int(input())
l = sys.stdin.read().split()
c = counter(l)
m = max(c.value())

if(m==1):
    print("YES")
else:
    print("NO")

### FIXED CODE ###

from collections import Counter
import sys
n = int(input())
l = sys.stdin.read().split()
c = Counter(l)
m = max(c.values())

if(m==1):
    print("YES")
else:
    print("NO")
def fact(n):
  ret=1
  for i in range(2.n+1):
    ret=ret*i
  return ret

n=int(input())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
cnt1=0
cnt2=0
checked1=[0]*(n+1)
checked2=[0]*(n+1)
for i in range(n):
  checked1[arr1[i]]=1
  checked2[arr2[i]]=1
  cnt1+=(arr1[i]-1-sum(checked1[:arr1[i]]))*fact(n-i-1)
  cnt2+=(arr2[i]-1-sum(checked2[:arr2[i]]))*fact(n-i-1)
print(abs(cnt1-cnt2))

### FIXED CODE ###

import itertools
n=int(input())
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))
arrs=list(itertools.permutations(range(1,n+1)))
cnt1=0
cnt2=0
for i in range(len(arrs)):
  if arrs[i]==p:
    cnt1=i
  if arrs[i]==q:
    cnt2=i
print(abs(cnt2-cnt1))
S=str(input())
s=list(S)
x,y=map(int,input().split())
fora=0
side=[]
updw=[]
while s[0]=="F":
  fora+=1
  s.pop(0)
  if len(s)==0:break
flag=1#1のとき横向き、-1のときたて向き
step=0
while s:
  if s[0]=="T":
    s.pop(0)
    if step:
      if flag==-1: updw+=[step]
      else: side+=[step]
    flag=flag*(-1)
    step=0
  else:
    s.pop(0)
    step+=1
    if len(s)==0:
      if flag==-1: updw+=[step]
      else: side+=[step]
ypossi=len(side)
tpossi=len(updw)
X=sum(side)+fora+x
Y=sum(updw)+y
xdp=[[0 for i in range(2*X+1)] for j in range(ypossi+1)]
#dp[i][j] i個文字使ったときにj+len(s)は達成できるか
xdp[0][fora+X]=1 
for i in range(ypossi):
  for j in range(2*X+1):
    if j-side[i]>=0:
      if xdp[i][j-side[i]]==1:xdp[i+1][j]=1
    if j+side[i]<2*X+1:
      if xdp[i][j+side[i]]==1:xdp[i+1][j]=1

ydp=[[0 for i in range(2*Y+1)] for j in range(tpossi+1)]
#dp[i][j] i個文字使ったときにj+len(s)は達成できるか
ydp[0][Y]=1 
for i in range(tpossi):
  for j in range(2*Y+1):
    if j-updw[i]>=0:
      if ydp[i][j-updw[i]]==1:ydp[i+1][j]=1
    if j+updw[i]<2*Y+1:
      if ydp[i][j+updw[i]]==1:ydp[i+1][j]=1
if xdp[ypossi][x+X]==1 and ydp[tpossi][y+Y]==1:
  print("Yes")
else: print("No")

### FIXED CODE ###

S=str(input())
s=list(S)
x,y=map(int,input().split())
fora=0
side=[]
updw=[]
while s[0]=="F":
  fora+=1
  s.pop(0)
  if len(s)==0:break
flag=1#1のとき横向き、-1のときたて向き
step=0
while s:
  if s[0]=="T":
    s.pop(0)
    if step:
      if flag==-1: updw+=[step]
      else: side+=[step]
    flag=flag*(-1)
    step=0
  elif s[0]=="F":
    s.pop(0)
    step+=1
    if len(s)==0:
      if flag==-1: updw+=[step]
      else: side+=[step]
  else: break
ypossi=len(side)
tpossi=len(updw)
X=sum(side)+fora+abs(x)
Y=sum(updw)+abs(y)
xdp=[[0 for i in range(2*X+1)] for j in range(ypossi+1)]
#dp[i][j] i個文字使ったときにj+len(s)は達成できるか
xdp[0][fora+X]=1 
for i in range(ypossi):
  for j in range(2*X+1):
    if j-side[i]>=0:
      if xdp[i][j-side[i]]==1:xdp[i+1][j]=1
    if j+side[i]<2*X+1:
      if xdp[i][j+side[i]]==1:xdp[i+1][j]=1

ydp=[[0 for i in range(2*Y+1)] for j in range(tpossi+1)]
#dp[i][j] i個文字使ったときにj+len(s)は達成できるか
ydp[0][Y]=1 
for i in range(tpossi):
  for j in range(2*Y+1):
    if j-updw[i]>=0:
      if ydp[i][j-updw[i]]==1:ydp[i+1][j]=1
    if j+updw[i]<2*Y+1:
      if ydp[i][j+updw[i]]==1:ydp[i+1][j]=1
if xdp[ypossi][x+X]==1 and ydp[tpossi][y+Y]==1:
  print("Yes")
else: print("No")
n=int(input())
d=list(map(int,input().split()))
D=sorted(d)
num=D[(n/2)]-D[(n/2)-1]
print(num)


### FIXED CODE ###

n=int(input())
d=list(map(int,input().split()))
D=sorted(d)
num=D[n//2]-D[(n//2)-1]
print(num)
n=int(input())
arr=list(map(int,input().split()))
total=sum(arr)
acum=[arr[0]]
for i in range(1,n):
  acum.append(arr[i]+acum[-1])
ans=10**18
for i in range(n):
  tmp=abs(acum[i]-(total-acu[i]))
  ans=min(ans,tmp)
print(ans)

### FIXED CODE ###

n=int(input())
arr=list(map(int,input().split()))
total=sum(arr)
acum=[arr[0]]
for i in range(1,n):
  acum.append(arr[i]+acum[-1])
ans=10**18
for i in range(n):
  tmp=abs(acum[i]-(total-acum[i]))
  ans=min(ans,tmp)
print(ans)
large_s = input()

con = 0
str_check = ""
for i in range(len(large_s)):
    z = large_s.find('hi', con, len(large_s))
    if (0 <= z):
        print(z)
        str_check += str(z)
        con += 2


if (str_check=='0' or str_check=='02' or str_check=='024' or str_check=='0246' or str_check=='02468'):
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

z = input()

if z=='hi' or z=='hihi' or z=='hihihi' or z=='hihihihi' or z=='hihihihihi':
    print("Yes")
else:
    print("No")