CodeEff/ECCO huggingface dataset:
# Original solution
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
s = LI()

h = []
for i in range(2**n):
    heappush(h,-s[i])
x = heappop(h)
use = [-x]
for i in range(n):
    tmp2 = []
    for j in use:
        tmp = []
        while h:
            x = heappop(h)
            x = -x
            if j > x:
                tmp2.append(x)
                break
            else:
                tmp.append(x)
        else:
            print('No')
            quit()
        for k in tmp:
            heappush(h,-k)
    use += tmp2
print('Yes')

# Optimized solution
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
s = LI()
s.sort(reverse=True)
use = [s[0]]
rest = s[1:]
for _ in range(n):
    new_use = []
    que = deque(rest)
    for i in use:
        rest_tmp = []
        while que:
            x = que.popleft()
            if i > x:
                new_use.append(x)
                break
            else:
                rest_tmp.append(x)
        que += rest_tmp
    use += new_use
    use.sort(reverse=True)
    rest = list(que)
    rest.sort(reverse=True)
if len(use) == 2**n:
    print('Yes')
else:
    print('No')
# Original solution
N=int(eval(input()))
S=list(map(int,input().split()))
S.sort()
p = [S.pop(-1)]
r = S

for i in range(N):
    for p_ in p[::-1]:
        for r_ in r[::-1]:
            if r_ < p_:
                p.append(r_)
                r.remove(r_)
                break
    p.sort()

print(("Yes" if len(r)==0 else "No"))

# Optimized solution
N=int(eval(input()))
S=list(map(int,input().split()))
S.sort()
p = [S.pop(-1)]
r = S

for i in range(N):
    nr = []
    for p_ in p[::-1]:
        while r:
            r_ = r.pop()
            if r_ < p_:
                p.append(r_)
                break
            nr.append(r_)
    p.sort()
    r+=nr[::-1]

print(("Yes" if len(r)==0 else "No"))
# Original solution
N=int(eval(input()))
S=list(map(int,input().split()))
S.sort()
p = [S.pop(-1)]
r = S

for i in range(N):
    nr = []
    for p_ in p[::-1]:
        while r:
            r_ = r.pop()
            if r_ < p_:
                p.append(r_)
                break
            nr.append(r_)
    p.sort()
    r+=nr[::-1]

print(("Yes" if len(r)==0 else "No"))


# Optimized solution
N=int(eval(input()))
S=list(map(int,input().split()))
S.sort()
p=[S[-1]]
r=S[:-1]

for i in range(N):
    nr = []
    for p_ in p[::-1]:
        while r:
            nr.append(r.pop())
            if nr[-1]<p_:
                p.append(nr.pop(-1))
                break
    p.sort()
    r+=nr[::-1]

print(("Yes" if len(r)==0 else "No"))
# Original solution
N=int(eval(input()))
S=list(map(int,input().split()))
S.sort()
p=[S[-1]]
r=S[:-1]

for i in range(N):
    nr = []
    for p_ in p[::-1]:
        while r:
            nr.append(r.pop())
            if nr[-1]<p_:
                p.append(nr.pop(-1))
                break
    p.sort()
    r+=nr[::-1]

print(("Yes" if len(r)==0 else "No"))

# Optimized solution
N=int(eval(input()))
S=list(map(int,input().split()))
S.sort()
p=S[-1:]
r=S[:-1]
for i in range(N):
    nr=[]
    for p_ in p[::-1]:
        while r:
            r_=r.pop()
            if r_<p_:
                p.append(r_)
                break
            nr.append(r_)
    p.sort()
    r+=nr[::-1]
print(("Yes" if len(r)==0 else "No"))
# Original solution
import sys
input = sys.stdin.readline
N = int(eval(input()))
S = list(map(int, input().split()))
S.sort(reverse=True)
Closed = [False] * (1<<N)
Closed[0] = True
for _ in range(N):
    cnt = 0
    cnt_ = 0
    s_old = -1
    for i, s in enumerate(S):
        if s_old!=s:
            cnt += cnt_
            cnt_ = 0
        c = Closed[i]
        if c:
            cnt_ += 1
        elif cnt > 0:
            Closed[i] = True
            cnt -= 1
        s_old = s
if False in Closed:
    print("No")
else:
    print("Yes")


# Optimized solution
N = int(eval(input()))
S = list(map(int, input().split()))
S.sort(reverse=True)
Closed = [False] * (1<<N)
Closed[0] = True
for j in range(N):
    num = 1<<j
    cnt_all = 0
    cnt = 0
    cnt_ = 0
    s_old = -1
    for i, s in enumerate(S):
        if s_old!=s:
            cnt += cnt_
            cnt_ = 0
        c = Closed[i]
        if c:
            cnt_ += 1
        elif cnt > 0:
            Closed[i] = True
            cnt -= 1
            cnt_all += 1
            if cnt_all == num:
                break
        s_old = s
    else:
        print("No")
        exit()
print("Yes")
# Original solution
from bisect import bisect_left

N = int(eval(input()))
S = [int(i) for i in input().split()]

def solve() :
    S.sort()
    T = [S.pop()]
    for i in range(N) :
        T.sort(reverse=True)
        for j in range(2**i) :
            if S[0] >= T[j] :
                return 'No'
            
            pos = bisect_left(S, T[j])
            T.append(S.pop(pos-1))
            
    return 'Yes'
    
print((solve()))

# Optimized solution
N = int(eval(input()))
S = [int(i) for i in input().split()]

def solve() :
    S.sort()
    par = [S.pop()]
    rst = S
    for _ in range(N) :
        n_par = []
        n_rst = []
        
        for p in par[::-1] :
            flg = True
            while rst :
                if rst[-1] < p :
                    n_par.append(rst.pop())
                    flg = False
                    break
                else :
                    n_rst.append(rst.pop())
            if flg :
                return 'No'
                
        par += n_par
        par.sort()
        rst += n_rst
        rst.sort()
            
    return 'Yes'
    
print((solve()))
# Original solution
import sys
import collections

def main():
    N,*S = list(map(int, open(0).read().split()))

    S = sorted(S)

    g = [S.pop(-1)]

    for gen in range(N):
        g.sort(reverse=True)
        for p in g[:2**gen]:
            for si, s in enumerate(S[::-1]):
                if p > s:
                    g.append(s)
                    S.pop(-(si+1))
                    break
            else:
                print('No')
                sys.exit()
    print('Yes')

if __name__=='__main__':
    main()

# Optimized solution
## 他の方と処理内容がほぼ同じなのに何でTLEになるか分からないので、他の方のコードでテスト
N = int(eval(input()))
a = list(map(int,input().split(' ')))
a.sort()
    

fathers = [a.pop()]
for _ in range(N):
    sons = list()
    b = list()
    
    for father in fathers:
        while a:
            x = a.pop()
            if father > x:
                sons.append(x)
                break
            else:
                b.append(x)
                
    a = a + b[::-1]
    fathers.extend(sons)
    fathers.sort(reverse = True)
    
    
    
if len(fathers) == 2**N:
    print('Yes')
else:
    print('No')
# Original solution
import sys

def main():
    N,*S = list(map(int, open(0).read().split()))
    S = sorted(S)

    g = [S.pop(-1)]

    for _ in range(N):
        g.sort(reverse=True)
        c = []
        for p in g:
            for si, s in enumerate(S[::-1]):
                if p > s:
                    c.append(s)
                    S.pop(-(si+1))
                    break
            else:
                print('No')
                sys.exit()
        g.extend(c)
    print('Yes')

if __name__=='__main__':
    main()

# Optimized solution
import sys

def main():
    N,*S = list(map(int, open(0).read().split()))
    S = sorted(S)

    g = [S.pop(-1)]

    for _ in range(N):
        c = []
        tmp = []
        for p in g:
            while S:
                s = S.pop(-1)
                if p > s:
                    c.append(s)
                    break
                else:
                    tmp.append(s)
            else:
                print('No')
                sys.exit()
        S.extend(tmp[::-1])
        g.extend(c)
        g.sort(reverse=True)
    print('Yes')

if __name__=='__main__':
    main()
# Original solution
import sys

def main():
    N,*S = list(map(int, open(0).read().split()))
    S = sorted(S)

    g = [S.pop(-1)]

    for _ in range(N):
        c = []
        tmp = []
        for p in g:
            while S:
                s = S.pop(-1)
                if p > s:
                    c.append(s)
                    break
                else:
                    tmp.append(s)
            else:
                print('No')
                sys.exit()
        S.extend(tmp[::-1])
        g.extend(c)
        g.sort(reverse=True)
    print('Yes')

if __name__=='__main__':
    main()

# Optimized solution
import sys

def main():
    N,*S = list(map(int, open(0).read().split()))
    S = sorted(S)

    g = [S.pop(-1)]

    for _ in range(N):
        tmp = []
        lg = len(g)
        for p in g[:lg]:
            while S:
                s = S.pop(-1)
                if p > s:
                    g.append(s)
                    break
                else:
                    tmp.append(s)
            else:
                print('No')
                sys.exit()
        S.extend(tmp[::-1])
        g.sort(reverse=True)
    print('Yes')

if __name__=='__main__':
    main()
# Original solution
from collections import Counter
n = int(eval(input()))
a = sorted(list(Counter(list(map(int, input().split()))).items()), reverse=True)
if len(a) == 2 ** n:
  print('Yes')
  exit(0)
g = [0]*(n+1)
g[n] = 1
for _, x in a:
  if sum(g) < x:
    print('No')
    break
  t = [0]*(n+1)
  for i in range(n, -1, -1):
    if g[i] <= x:
      t[i-1] = t[i] + g[i]
      x -= g[i]
      g[i] = 0
    else:
      t[i-1] = t[i] + x
      g[i] -= x
      x = 0
  t[n] = 0
  g = [x+y for x,y in zip(g, t)]
else:
  print('Yes')


# Optimized solution
from collections import Counter
n = int(eval(input()))
a = sorted(list(Counter(list(map(int, input().split()))).items()), reverse=True)
g = [0]*(n+1)
g[n] = 1
for _, x in a:
  if sum(g) < x:
    print('No')
    break
  t = [0]*(n+1)
  for i in range(n, -1, -1):
    if g[i] <= x:
      t[i-1] = t[i] + g[i]
      x -= g[i]
      g[i] = 0
    else:
      t[i-1] = t[i] + x
      g[i] -= x
      x = 0
  t[n] = 0
  g = [x+y for x,y in zip(g, t)]
else:
  print('Yes')
# Original solution
def i1():
 return int(eval(input()))
def i2():
 return [int(i) for i in input().split()]
import sys
sys.setrecursionlimit(10**6)
n=i1()
s=i2()
m=10**9+1
import heapq
import bisect
s.sort()
x=[s[-1]]
s[-1]=m
a="Yes"
for i in range(n):
 y=[]
 for j in range(1<<i):
   s.sort()
   z=bisect.bisect_left(s,x[j])-1
   if z<0:
     a="No"
   y.append(s[z])
   s[z]=m
 x+=y
 x.sort(reverse=True)
print(a)

# Optimized solution
def i1():
 return int(eval(input()))
def i2():
 return [int(i) for i in input().split()]
n=i1()
s=i2()
m=10**9+1
s.sort(reverse=True)
x=[s[0]]
s[0]=m
a="Yes"
for i in range(n):
 y=[]
 k=0
 for j in range(len(s)):
   if k>=len(x):
      break
   if s[j]<x[k]:
     y.append(s[j])
     s[j]=m
     k+=1
 x+=y
 x.sort(reverse=True)
if k==(1<<(n-1)):
   print("Yes")
else:
   print("No")
# Original solution
import sys
input = sys.stdin.readline

n = int(eval(input()))
S = sorted(map(int, input().split()), reverse=True)
L = [S[0]]
used = [False]*(1<<n)
used[0] = True
for i in range(n):
  T = []
  for l in L:
    for j, s in enumerate(S):
      if used[j]:
        continue
      if l > s:
        T.append(s)
        used[j] = True
        break
    else:
      print("No")
      exit()
  L += T
print("Yes")

# Optimized solution
import sys
input = sys.stdin.readline

n = int(eval(input()))
S = sorted(map(int, input().split()), reverse=True)
L = [S[0]]
used = [False]*(1<<n)
used[0] = True
for i in range(n):
  L.sort(reverse=True)
  idx = 0
  for j, s in enumerate(S):
    if used[j]:
      continue
    if L[idx] > s:
      L.append(s)
      used[j] = True
      idx += 1
      if idx == 1<<i:
        break
  else:
    print("No")
    exit()
print("Yes")
# Original solution
import bisect

n = int(eval(input()))
s = list(map(int, input().split(" ")))
# n = 18
# s = list(reversed(range(1, 2 ** n + 1)))

s = sorted(s)
from collections import deque

def solve():
    global s

    parents = [s[-1]]
    s.pop()

    for i in range(n):
        newparents = list(parents)
        k = len(s)
        dropped = set()
        # print(parents)
        for p in parents:
            oldK = k
            k = bisect.bisect(s[:k], p - 1) - 1
            # print("Old", oldK, k, s[k], p)
            if k == -1:
                print("No")
                exit(0)

            newparents.append(s[k])
            dropped.add(k)
        s = [x for i, x in enumerate(s) if i not in dropped]

        parents = sorted(newparents, reverse=True)

    # print(parents)
    # print(k)
    if k == len(s):
        print("Yes")
    else:
        print("No")
solve()


# Optimized solution
import bisect

n = int(eval(input()))
s = list(map(int, input().split(" ")))
# n = 18
# s = list(reversed(range(1, 2 ** n + 1)))

s = sorted(s)
from collections import deque

def solve():
    global s

    parents = [s[-1]]
    s.pop()

    for i in range(n):
        newparents = list(parents)
        k = len(s)
        dropped = set()
        # print(parents)
        for p in parents:
            oldK = k
            k = bisect.bisect(s, p - 1, 0, k) - 1
            # print("Old", oldK, k, s[k], p)
            if k == -1:
                print("No")
                exit(0)

            newparents.append(s[k])
            dropped.add(k)
        s = [x for i, x in enumerate(s) if i not in dropped]
        parents = sorted(newparents, reverse=True)

    # print(parents)
    # print(k)
    if k == len(s):
        print("Yes")
    else:
        print("No")
solve()
# Original solution
from heapq import heappush, heappop
from copy import deepcopy

n = int(eval(input()))
s = list(map(int, input().split()))

left = []
for e in s:
    heappush(left, -e)
mx = heappop(left)

made = []
heappush(made, mx)

for _ in range(n):
    made_nxt = deepcopy(made)
    tmp = []

    while made:
        made_val = heappop(made)
        while left and left[0] <= made_val:
            pp = heappop(left)
            tmp.append(pp)

        if not left:
            print("No")
            exit()

        left_val = heappop(left)
        heappush(made_nxt, left_val)

    made = made_nxt

    for e in tmp:
        heappush(left, e)

print("Yes")


# Optimized solution
from heapq import heappush, heappop
from copy import deepcopy

n = int(eval(input()))
s = list(map(int, input().split()))

left = []
for e in s:
    heappush(left, -e)
mx = heappop(left)

made = []
heappush(made, mx)

for _ in range(n):
    made_prev = deepcopy(made)
    tmp = []

    while made_prev:
        made_val = heappop(made_prev)
        while left and left[0] <= made_val:
            pp = heappop(left)
            tmp.append(pp)

        if not left:
            print("No")
            exit()

        left_val = heappop(left)
        heappush(made, left_val)

    for e in tmp:
        heappush(left, e)

print("Yes")
# Original solution
import heapq

N = int(eval(input()))
N2 = 2**N
S = list(map(int, input().split()))
S = [-s for s in S]
heapq.heapify(S)

slimes = [heapq.heappop(S)]
num = 1
for i in range(N):
  slimes.sort(reverse=True)
  n = num
  temp = []
  while n and S:
    s = heapq.heappop(S)
    if s > slimes[n-1]:
      slimes.append(s)
      n -= 1
    else:
      temp.append(s)
  
  if n:
    print('No')
    quit()
  
  num *= 2
  for t in temp:
    heapq.heappush(S, t)


print('Yes')

# Optimized solution
N = int(eval(input()))
N2 = 2**N
S = list(map(int, input().split()))
S.sort(reverse=True)

slimes = [S[0]]
S[0] = float('inf')
num = 1
min_idx = 1
for i in range(N):
  slimes.sort()
  n = num
  idx = min_idx
  is_continuous = True
  while n and idx<=N2-1:
    if S[idx] < slimes[n-1]:
      slimes.append(S[idx])
      S[idx] = float('inf')
      idx += 1
      n -= 1
      min_idx += is_continuous
    else:
      if S[idx] < float('inf'):
        is_continuous = False
      idx += 1
      min_idx += is_continuous
  
  if n:
    print('No')
    quit()
  
  num *= 2

print('Yes')
# Original solution
N = int(eval(input()))
N2 = 2**N
S = list(map(int, input().split()))
S.sort(reverse=True)

slimes = [S[0]]
S[0] = float('inf')
num = 1
min_idx = 1
for i in range(N):
  slimes.sort()
  n = num
  idx = min_idx
  is_continuous = True
  while n and idx<=N2-1:
    if S[idx] < slimes[n-1]:
      slimes.append(S[idx])
      S[idx] = float('inf')
      idx += 1
      n -= 1
      min_idx += is_continuous
    else:
      if S[idx] < float('inf'):
        is_continuous = False
      idx += 1
      min_idx += is_continuous
  
  if n:
    print('No')
    quit()
  
  num *= 2

print('Yes')

# Optimized solution
N = int(eval(input()))
N2 = 2**N
S = list(map(int, input().split()))
S.sort(reverse=True)

slimes = [S[0]]
INF = S[0] + 1
S[0] = INF
num = 1
min_idx = 1
for i in range(N):
  slimes.sort()
  n = num
  idx = min_idx
  is_continuous = True
  while n and idx<=N2-1:
    if S[idx] < slimes[n-1]:
      slimes.append(S[idx])
      S[idx] = INF
      idx += 1
      n -= 1
      min_idx += is_continuous
    else:
      if S[idx] < INF:
        is_continuous = False
      idx += 1
      min_idx += is_continuous
  
  if n:
    print('No')
    quit()
  
  num *= 2

print('Yes')
# Original solution
import bisect

N = int(eval(input()))
S = sorted([int(x) for x in input().split()])

Slimes = [S.pop(-1)]

flag = True
for i in range(1, N + 1):
    newSlimes = []
    for j in Slimes:
        idx = bisect.bisect_left(S, j)
        if idx == 0:
            flag = False
            break
        newSlimes.append(S.pop(idx-1))
    if not flag:
        break
    Slimes.extend(newSlimes)

print(('Yes' if flag else 'No'))

# Optimized solution
N = int(eval(input()))
N2 = 1 << N

S = sorted([int(x) for x in input().split()])

s = []
s.append(S[-1])
S[-1] = -1

flag = True
for i in range(N):
    p = sorted([x for x in s])

    Si = N2 - 1
    while len(p) > 0 and Si >= 0:
        if S[Si] == -1:
            Si -= 1
            continue

        if S[Si] < p[-1]:
            s.append(S[Si])
            del p[-1]
            S[Si] = -1
        
        Si -= 1
    
    if len(p) > 0:
        flag = False

print(('Yes' if flag else 'No'))
# Original solution
import sys

def bsearch(target, min_i, max_i, func):
    # func(index) < target <= func(index+1) となるindexを返す
    if func(max_i) < target:
        return max_i
    if target <= func(min_i):
        return None
    index = (max_i + min_i)//2
    while True:
        if func(index) < target:
            if target <= func(index+1):
                return index
            index, min_i = (index+1 + max_i)//2, index+1
            continue
        index, max_i = (index-1 + min_i)//2, index-1

n=int(eval(input()))
xs = sorted(list(map(int,input().split())))
bs = [xs.pop()]
cs = xs
for _ in range(n):
    for bi in range(len(bs)):
        ci = bsearch(bs[bi], 0, len(cs)-1, lambda x : cs[x])
        if ci == None:
            print("No")
            sys.exit()
        bs.append(cs[ci])
        del cs[ci]
print("Yes")




# Optimized solution
import sys
def b(bs, cs):
    d = set()
    bl, cl = len(bs), len(cs)
    bi, ci = 0, 0
    ncs = []
    while True:
      if bs[bi] > cs[ci]:
        bs.append(cs[ci])
        bi += 1
      else:
        ncs.append(cs[ci])
      ci += 1
      if bi == bl or ci == cl:
        break
    if len(bs) != 2 * bl:
      print("No")
      sys.exit()
    return bs, ncs + cs[ci:]

n=int(eval(input()))
xs = sorted(list(map(int,input().split())))[::-1]
bs, cs = xs[:1], xs[1:]
for _ in range(n):
    bs, cs = b(sorted(bs)[::-1], cs)

print("Yes")
# Original solution
N = int(eval(input()))
S = list(map(int, input().split()))
INF = 10 ** 10

S.sort()

parents = [S[-1]]
S[-1] = INF
from_here = 1

for _ in range(N):
    checking = from_here
    first = True
    parents.sort(reverse=True)
    for i in parents[:]:
        while True:
            if S[-checking] < i and first:
                parents.append(S[-checking])
                S[-checking] = INF
                from_here = checking + 1
                break
            elif S[-checking] < i:
                parents.append(S[-checking])
                S[-checking] = INF
                break
            else:
                checking += 1
                first = False
            if checking == 2 ** N + 1:
                print('No')
                exit()
else:
    print('Yes')

# Optimized solution
def main():
    N = int(eval(input()))
    S = list(map(int, input().split()))
    INF = float('inf')

    S.sort()

    parents = [S[-1]]
    S[-1] = INF

    for _ in range(N):
        checking = 2
        parents.sort(reverse=True)
        for i in parents[:]:
            while True:
                if S[-checking] < i:
                    parents.append(S[-checking])
                    S[-checking] = INF
                    break
                else:
                    checking += 1
                if checking == 2 ** N + 1:
                    print('No')
                    exit()
    else:
        print('Yes')


if __name__ == '__main__':
    main()
# Original solution
import sys


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


s = S()
ans = ''
if 'C' in s:
    ans += 'C'
    if 'F' in s[s.index('C'):]:
        ans += 'F'
if ans == 'CF':
    print('Yes')
else:
    print('No')


# Optimized solution
import sys


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


s = S()
ans = ''
if 'C' in s:
    ans += 'C'
    if 'F' in s[s.find('C'):]:
        ans += 'F'
if ans == 'CF':
    print('Yes')
else:
    print('No')