Harryxun/stf_run huggingface dataset:
N = int(input())
job = [[0] * N for _ in range(N)]
for i in range(N):
    job[i] = list(map(int, input().split()))
#print(job)
job.sort(key=lambda x: x[1])
#print(job)
#for i in range(1, N):
#    job[i][1] += job[i - 1][1]
rest = 0
for i in range(N):
    if job[i][0] > job[i][1] + rest:
        print("No")
        break
    rest += rest + (job[i][1] - job[i][0])
else:
    print("Yes")

### FIXED CODE ###


N = int(input())
job = []
for i in range(N):
    a, b = map(int, input().split())
    job.append([a, b])
#print(job)
job.sort(key=lambda x: x[1])
#print(job)
for i in range(1, N):
    job[i][0] += job[i - 1][0]
for i in range(N):
    if job[i][0] > job[i][1]:
        print("No")
        break
else:
    print("Yes")
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    L, R = map(int, readline().split())

    if L - R + 1 >= 2019:
        print(0)
    else:
        A = [i % 2019 for i in range(L, R + 1)]
        A.sort()
        print(A[0] * A[1])

    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def distance2_nd(p, q):
    return sum((px - qx) ** 2 for px, qx in zip(p, q))


def isqrt(n):
    if n > 0:
        x = 1 << (n.bit_length() + 1) // 2
        y = (x + n // x) // 2
        while y < x:
            x = y
            y = (x + n // x) // 2
        return x
    elif n == 0:
        return 0
    else:
        raise ValueError("isqrt() argument must be nonnegative")


def main():
    N, D = map(int, readline().split())
    X = [list(map(int, readline().split())) for _ in range(N)]

    ans = 0
    for i in range(N):
        for j in range(i + 1, N):
            d2 = distance2_nd(X[i], X[j])
            di = isqrt(d2)
            if di * di == d2:
                ans += 1

    print(ans)
    return


if __name__ == '__main__':
    main()
a,b,c = list(map(int, input().split()))
d,e,f = list(map(int, input().split()))	
g,h,k = list(map(int, input().split()))
N = int(input())
l = []
for i in range(N):
	e=int(input())
	l.append(e)
L1 = {a,d,g}
L2 = {a,b,c}
L3 = {a,e,k}
L4 = {c,f,k}
L5 = {g,h,k}
L6 = {c,e,g}
for i in range(N):
	for j in range(N):
		for k in range(N):
			s = set([l[i],l[j],l[k]])
			if (s == L1) or (s == L2) or (s == L3) or (s == L4) or (s == L5) or (s == L6) :
				print('Yes')
				exit(0)
		
print('No')












### FIXED CODE ###

N = int(input())
if N%2 == 0:
  print(N//2)
else:
  print(N//2 + 1)
a = list(input())
i = 0
while True:
    odd = a[i]
    if odd == 'L':
        print('NO')
        break
    i += 1
    if i+1 == len(a):
        print('YES')
        break
    even = a[i]
    if even == 'R':
        print('NO')
    i += 1
    if i+1 == len(a):
        print('YES')
        break


### FIXED CODE ###

a = list(input())
i = 0
while True:
    odd = a[i]
    if odd == 'L':
        print('No')
        break
    i += 1
    if i == len(a):
        print('Yes')
        break
    even = a[i]
    if even == 'R':
        print('No')
        break
    i += 1
    if i == len(a):
        print('Yes')
        break
k ,n  = map(int, input().split(" "))
alist = list(map(int, input().split(" "))
glist =  []
for i in range(n-1):
    glist.append(alist[i+1]-alist[i])
glist.append(k+alist[0]-alist[n-1])

print(int(k-max(glist)))
    
   

### FIXED CODE ###

k,n = map(int,input().split(" "))
alist = list(map(int, input().split(" ")))
glist = []
for i in range(n-1):
  glist.append(alist[i+1]-alist[i])
glist.append(k+alist[0]-alist[n-1])

print(k-max(glist))
class obj:
    def __init__(self, N):
        self.fa = [i for i in range(N)]
    def find(self, x):
        if x == self.fa[x]:
            return x
        else:
            self.fa[x] = self.find(self.fa[x])
            return self.fa[x]

N = int(input())
node = [{"x":0, "y":0, "id":i} for i in range(N)]
edge = [{"u":0, "v":0, "d":0} for i in range(2*(N-1))]
ob = obj(N)
for i in range(N):
    node[i]["x"], node[i]["y"] = map(int, input().split())
    node[i]["id"] = i

xnode = sorted(node[0:N], key=lambda x:x["x"])
for i in range(N-1):
    edge[i]["u"] = xnode[i]["id"]
    edge[i]["v"] = xnode[i+1]["id"]
    edge[i]["d"] = xnode[i+1]["x"] - xnode[i]["x"]
ynode = sorted(node[0:N], key=lambda x:x["y"])
for i in range(N-1):
    edge[i+N-1]["u"] = ynode[i]["id"]
    edge[i+N-1]["v"] = ynode[i+1]["id"]
    edge[i+N-1]["d"] = ynode[i+1]["y"] - ynode[i]["y"]
dedge = sorted(edge[0:2*N], key=lambda x:x["d"])
ans = 0
for i in range(2*(N-1)):
    if ob.find(dedge[i]["u"]) != ob.find(dedge[i]["v"]):
        ans += dedge[i]["d"]
        ob.fa[ob.fa[dedge[i]["u"]]] = ob.fa[dedge[i]["v"]]
print(ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(int(2e9))
class obj:
    def __init__(self, N):
        self.fa = [i for i in range(N)]
    def find(self, x):
        if x == self.fa[x]:
            return x
        else:
            self.fa[x] = self.find(self.fa[x])
            return self.fa[x]

N = int(input())
node = [{"x":0, "y":0, "id":i} for i in range(N)]
edge = [{"u":0, "v":0, "d":0} for i in range(2*(N-1))]
ob = obj(N)
for i in range(N):
    node[i]["x"], node[i]["y"] = map(int, input().split())
    node[i]["id"] = i

xnode = sorted(node, key=lambda x:x["x"])
for i in range(N-1):
    edge[i]["u"] = xnode[i]["id"]
    edge[i]["v"] = xnode[i+1]["id"]
    edge[i]["d"] = xnode[i+1]["x"] - xnode[i]["x"]
ynode = sorted(node, key=lambda x:x["y"])
for i in range(N-1):
    edge[i+N-1]["u"] = ynode[i]["id"]
    edge[i+N-1]["v"] = ynode[i+1]["id"]
    edge[i+N-1]["d"] = ynode[i+1]["y"] - ynode[i]["y"]
dedge = sorted(edge, key=lambda x:x["d"])
ans = 0
for i in range(2*(N-1)):
    if ob.find(dedge[i]["u"]) != ob.find(dedge[i]["v"]):
        ans += dedge[i]["d"]
        ob.fa[ob.fa[dedge[i]["u"]]] = ob.fa[dedge[i]["v"]]
print(ans)
def fact(n):
  if n==1:
    return 1
  else:
    return n*fact(n-1)
n,m=map(int,input().split())
if n==m:
  print(2*(fact(n))**2%(10**9+7))
elif abs(n-m)=1:
  print(fact(n)*fact(m)%(10**9+7))
else:
  print(0)
  

### FIXED CODE ###

import math
n,m=map(int,input().split())
a=math.factorial(n)
b=math.factorial(m)
if n==m:
  print((2*a**2)%(10**9+7))
elif abs(n-m)==1:
  print((a*b)%(10**9+7))
else:
  print(0)
a, b, c, k = map(int, input().split())

for i in range(10**18):
    A = a
    B = b
    C = c
    a = B + C
    b = A + C
    c = A + B
    if i = k - 1:
        break
if abs(a - b) <= 10**18:
    print(a - b)
else:
    print('Unfair')

### FIXED CODE ###

a, b, c, k = map(int, input().split())
x = a - b
if x > 10**18:
    print('Unfair')
elif k % 2 == 0:
    print(x)
else:
    print(-x)
S = int(input())
h = S // 3600
m = (S - h*3600)//60
s = S - h*3600 - m*60

print(h,':'m,':',s)


### FIXED CODE ###

S = int(input())
h = S // 3600
m = (S - h*3600)//60
s = S - h*3600 - m*60

print(str(h)+':'+str(m)+':'+str(s))
N, Q = map(int, input().split())
S = str(input())
li = []
cnt = 0

for i in range(N-1):
  if S[i]=='A' and S[i+1]=='C':
    cnt += 1
    li.append(cnt)
  else:
    li.append(cnt)

for i in range(Q):
  l, r = map(int, input().split())
  ans = li[r-1] - li[:l-1]
  print(ans)


### FIXED CODE ###

N, Q = map(int, input().split())
S = str(input())
li = []
cnt = 0

for i in range(N-1):
  if S[i]=='A' and S[i+1]=='C':
    cnt += 1
    li.append(cnt)
  else:
    li.append(cnt)

for i in range(Q):
  l, r = map(int, input().split())
  if l > 1:
    ans = li[r-2] - li[l-2]
  else:
    ans = li[r-2]
  print(ans)
a = int(raw_input())
print(a * a * a)

### FIXED CODE ###

print(int(input())**3)
r, g, b = map(int, input().split)

number = r * 100 + g * 10 + b

if number % 4 = 0:
  print("YES")
 
else:
  print("NO")

### FIXED CODE ###

r, g, b = map(int, input().split())
 
number = r * 100 + g * 10 + b
 
if number % 4 == 0:
  print("YES")
else:
  print("NO")
import copy
n = int(input())
o = list(map(int, input().split()))

#11
#6 7 1 2 1 2 1 2 6 5 6
a0 = {}
a1 = {}
a0c = n//2 + n%2
a1c = n//2
for i in range(0, n, 2):
    oo = o[i]
    if oo in a0.keys():
        a0[oo] += 1
    else:
        a0[oo] = 1

for i in range(1, n, 2):
    oo = o[i]
    if oo in a1.keys():
        a1[oo] += 1
    else:
        a1[oo] = 1

k0 = [kv[0] for kv in a0.items() if kv[1] == max(a0.values())]
ans0 = a0c - a0[k0[0]]
a1_copy = copy.deepcopy(a1)
if k0[0] in a1_copy:
    del a1_copy[k0[0]]
if len(a0_copy) != 0:
    k1= [kv[0] for kv in a1_copy.items() if kv[1] == max(a1_copy.values())]
    ans1 = a1c - a1_copy[k1[0]]
else:
    ans1 = a1c

ans_a = ans0 + ans1

k0 = [kv[0] for kv in a1.items() if kv[1] == max(a1.values())]
ans0 = a1c - a1[k0[0]]
a0_copy = copy.deepcopy(a0)
if k0[0] in a0_copy:
    del a0_copy[k0[0]]
if len(a1_copy) != 0:
    k1= [kv[0] for kv in a0_copy.items() if kv[1] == max(a0_copy.values())]
    ans1 = a0c - a0_copy[k1[0]]
else:
    ans1 = a0c

ans_b = ans0 + ans1

print(min(ans_a, ans_b))

### FIXED CODE ###

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

#11
#6 7 1 2 1 2 1 2 6 5 6

import collections as cl
a0 = cl.Counter(o[0::2]).most_common()
a1 = cl.Counter(o[1::2]).most_common()
a0.append((0,0))
a1.append((0,0))
if a0[0] != a1[0]:
    count = n - a0[0][1] - a1[0][1]
else:
    count = min(n - a0[1][1] - a1[0][1], n - a0[0][1] - a1[1][1])

print(count)
def product(a,b):
    return a*b
    
a=int(input())
b=int(input())
print(product(a,b))

### FIXED CODE ###

def product(a,b):
    return a*b
    
a,b=map(int,input().split())
print(product(a,b))
import math
a, b = map(int, input().split())
print(a * b / math.gcd(a, b))

### FIXED CODE ###

def gcd(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x
a, b = map(int, input().split())
print(a * b // gcd(a, b))
d = int(input())
s = 'Christmas'
for i range(25-d):
  s = s+' Eve'
print(s)

### FIXED CODE ###

d = int(input())
s = 'Christmas'
for i in range(25-d):
  s = s+' Eve'
print(s)
from math import factorical
print(factorical(int(input()))

### FIXED CODE ###

from math import factorial
print(factorial(int(input())))
H,W,K = map(int,input().split())
import numpy as np
from collections import deque
ans = 10000
S = np.array([list(map(int,list(input()))) for _ in range(H)])
cum = [[0]*W for _ in range(H+1)]
for j in range(W):
  for i in range(1,H+1):
    cum[i][j] = cum[i-1][j]+S[i-1][j]
    
cum = np.array(cum)
for i in range(2**(H-1)):
  q = deque([0])
  for h in range(H):
    if (i>>h)&1:
      q.append(h+1)
  q.append(H)
  p = deque()
  for a in range(len(q)-1):
    x = cum[q[a+1]]-cum[q[a]]
    if (x>K).any():
      judge = True
      break
    else:
      p.append(x)

  if judge:
    continue
  
  t_a = len(q)-2
  l = [0]*len(p)
  judge = False
  for w in range(W):
    for x,a in enumerate(p):
      l[x]+=a[w]
      if l[x]>K:
        t_a+=1
        l = [0]*len(p)
        for z,b in enumerate(p):
          l[z] = b[w]
        break
  ans = min(ans,t_a)
    
print(ans)

### FIXED CODE ###

def main():
  H,W,K = map(int,input().split())
  import numpy as np
  from collections import deque
  ans = 10000
  S = np.array([list(map(int,list(input()))) for _ in range(H)])
  cum = [[0]*W for _ in range(H+1)]
  for j in range(W):
    for i in range(1,H+1):
      cum[i][j] = cum[i-1][j]+S[i-1][j]

  cum = np.array(cum)
  for i in range(2**(H-1)):
    j = 0
    q = deque([0])
    for h in range(H):
      if (i>>h)&1:
        q.append(h+1)
    q.append(H)
    t_a = len(q)-2
    if t_a>=ans:
      continue
    p = deque()
    judge = False
    for a in range(len(q)-1):
      x = cum[q[a+1]]-cum[q[a]]
      if (x>K).any():
        judge = True
        break
      else:
        p.append(list(x))

    if judge:
      continue
    n = len(p)
    l = [0]*n
    for w in range(W):
      y = [l[j]+p[j][w] for j in range(n)]
      if max(y)>K:
        t_a+=1
        l = [p[j][w] for j in range(n)]
        if t_a>=ans:
          judge = True
          break
      else:
        l = y
    if judge:
      continue
    ans = min(ans,t_a)

  print(ans)
  
main()
# E

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

def gcd(a,b):
    if a>b:
        a,b=b,a
    while a%b:
        a,b=b,(a%b)
    return b

def fast_factorization_init(N):
    res=list(range(N))
    for i in range(2,N):
        if i*i>N:
            break
        for j in range(i*i,N,i):
            if res[j]==j:
                res[j]=i
        if res[i]<i:
            continue
    return res            
    
min_factors=fast_factorization_init(10**5)
def fast_factorization(n):
    res=[]
    while n>1:
        res.append(min_factors[n])
        n//=min_factors[n]
    return res

res2=1
P=[]
for i in range(N):
    if i!=0:
        res1=gcd(A[i],res1)
    else:
        res1=A[0]
    fact=fast_factorization(A[i])
    if res2!=0:
        for p in P:
            if A[i]%p==0:
                res2=0
                break
    for p in fact:
        P.append(p)
if res2==1:
    print('pairwise coprime')
elif res1==1:
    print('setwise coprime')
else:
    print('not coprime')

### FIXED CODE ###

# E

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

def gcd(a,b):
    if a>b:
        a,b=b,a
    while a%b:
        a,b=b,(a%b)
    return b

def fast_factorization_init(N):
    res=list(range(N))
    for i in range(2,N):
        if i*i>N:
            break
        for j in range(i*i,N,i):
            if res[j]==j:
                res[j]=i
        if res[i]<i:
            continue
    return res            
    
min_factors=fast_factorization_init(10**6+10)
def fast_factorization(n):
    res=[]
    while n>1:
        res.append(min_factors[n])
        n//=min_factors[n]
    return list(set(res))

res2=0
P=[]
for i in range(N):
    if i!=0:
        res1=gcd(A[i],res1)
    else:
        res1=A[0]
    P += fast_factorization(A[i])

if len(set(P))==len(P):
    res2=1

if res2==1:
    print('pairwise coprime')
elif res1==1:
    print('setwise coprime')
else:
    print('not coprime')
import math
n, m = input().split()
m = int(m)
n = int(n)
mNum = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))
nNum = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))
print(int(mNum + nNum))

### FIXED CODE ###

import math
n, m = input().split()
m = int(m)
n = int(n)
if n == 1 or n == 0:
	nNum = 0
else:
	nNum = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))
if m == 1 or m == 0:
	mNum = 0
else:
	mNum = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))
print(int(mNum + nNum))
# import sys
# input = sys.stdin.readline
n = int(input())
h = list(map(int,input().split()))
count_list = []
count = 0
i = n-1
while 0<i<n:
    if h[i-1]>=h[i]:
        count += 1
        i -= 1
    else:
        count_list.append(count)
        count = 0
        i = i-1
# print(count_list)
print(max(count_list))

### FIXED CODE ###

# import sys
# input = sys.stdin.readline
n = int(input())
h = list(map(int,input().split()))
if n==1:
    print(0)
    exit()
else:
    count_list = []
    count = 0
    i = n-1
    while i<n:
        # print(i)
        if i>0 and h[i-1]>=h[i]:
            count += 1
            i -= 1
        else:
            count_list.append(count)
            count = 0
            if i>0:
                i = i-1
            elif i==0:
                break
print(max(count_list))
A = map(int,input().split())
B = map(int,input().split())
if 1 <= A <= 9 and 1<= B <= 9:
	print(A*B)
else:
	print(-1)

### FIXED CODE ###

a,b=map(int,input().split())
if 1<=a<=9 and 1<=b<=9:
  print(a*b)
else:
  print(-1)
n,q = map(int,input().split())
s = input()
num = []
for Q in range(q):
	l,r = map(int,input().split())
	num.append(int(s[l - 1:r].count('AC')))
print('/n'.join(num))

### FIXED CODE ###

N,Q = map(int,input().split())
S = input()
r = [0 for n in range(N)]
l = [0 for n in range(N)]
cnt = 0
for s in range(N - 1):
	if S[s] == 'A':
		if S[s + 1] == 'C':
			cnt += 1
	l[s + 1] = cnt
cnt = 0
for s in range(1,N):
	if S[-s] == 'C':
		if S[-s - 1] == 'A':
			cnt += 1
	r[-s - 1] = cnt
for q in range(Q):
	L,R = map(int,input().split())
	print(cnt - l[L - 1] - r[R - 1])
s = list(map(int, input().split()))
N = i[0]
M = i[1]
C = i[2]
B = list(map(int, input().split()))
x = 0
for i in range(N):
  k = C
  A = list(map(int, input().split()))
  for j in range(M):
    k = k + A[j] * B[j]
  if k > 0:
    x = x + 1
  else:
    pass
print(x)  

### FIXED CODE ###

s = list(map(int, input().split()))
N = s[0]
M = s[1]
C = s[2]
B = list(map(int, input().split()))
x = 0
for i in range(N):
  k = C
  A = list(map(int, input().split()))
  for j in range(M):
    k = k + A[j] * B[j]
  if k > 0:
    x = x + 1
  else:
    pass
print(x)
h,w = map(int,input().split())
C = [list(input()) for i in range(h)]

queue = []
visited = [] 
ans = []
for i in range(h):
    T = [0]*w
    visited.append(T) 
    
for i in range(h):
    for j in range(w):
        if C[i][j] == '.':
            queue.append([i,j])
            visited[i][j] = 1

            dy_dx = [[1,0],[0,1],[-1,0],[0,-1]]

            count = 0
            p = 0
            while len(queue) > 0:
              now = queue.pop(0)
              for i in range(4):
                y = now[0]+dy_dx[i][0]
                x = now[1]+dy_dx[i][1]
                if 0 <= y < h and 0 <= x < w:
                  if C[y][x] != '#' and visited[y][x] == 0:
                    visited[y][x] = 1
                    queue.append([y,x])
                    if p == 0:
                      count += 1
                      p += 1
              p = 0
        ans.append(count)
        queue = []
        visited = []  
        for i in range(h):
            T = [0]*w
            visited.append(T) 
        
print(max(ans))

### FIXED CODE ###

h,w = map(int,input().split())
C = [list(input()) for i in range(h)]

queue = []
visited = [] 
ans = 0
for i in range(h):
    T = [0]*w
    visited.append(T) 


for i in range(h):
    for j in range(w):
        if C[i][j] == '.':
            queue.append([i,j])
            visited[i][j] = 1

            dy_dx = [[1,0],[0,1],[-1,0],[0,-1]]

            while len(queue) > 0:
                now = queue.pop(0)
                for k in range(4):
                    y = now[0]+dy_dx[k][0]
                    x = now[1]+dy_dx[k][1]
                    if 0 <= y < h and 0 <= x < w:
                        if C[y][x] != '#' and visited[y][x] == 0:
                            visited[y][x] = visited[now[0]][now[1]]+1
                            queue.append([y,x])
                    
        for ii in range(h):
            for jj in range(w):
                ans = max(ans,visited[ii][jj])
            
        queue = []
        visited = [] 
        for l in range(h):
            T = [0]*w
            visited.append(T) 
                        
        
print(ans-1)
n = 20
a = 2
b = 5

n = int(input())
a = int(input())
b = int(input())

sum1 = 0

for i in range(1,n+1):
    d = list(str(i))
    sum2 = 0
    for i2 in d:
        sum2 = sum2 + int(i2)
    if(a<=sum2 and sum2<=b):
        sum1 = sum1 + int(i)

print(sum1)


### FIXED CODE ###

n = 20
a = 2
b = 5

i = input()
d = i.split()
n = int(d[0])
a = int(d[1])
b = int(d[2])

sum1 = 0

for i in range(1,n+1):
    d = list(str(i))
    sum2 = 0
    for i2 in d:
        sum2 = sum2 + int(i2)
    if(a<=sum2 and sum2<=b):
        sum1 = sum1 + int(i)

print(sum1)
num = int(input())
hoge = list(map(int, input().split()))
fuga = 0
for i in range(num):
  count = 0
  for j in range(fuga, num):
    if hoge[j] == i + 1:
      count += 1
  fuga += count
  print(count)

### FIXED CODE ###

num = int(input())
hoge = list(map(int, input().split()))

fuga = [0] * num

for i in hoge:
  fuga[i - 1] += 1
for i in fuga:
  print(i)
n,m = map(int,input().split())
s_lst = [list(map(int,input().split())) for i in range(m)]
k_lst = []
for i in range(m):
    k = s_lst.pop(s_lst[i][0])
    k_lst.append(k)
p_lst = list(map(int,input().split()))
answer = 0

for i in range(2**n): #各電球がonかoffかビット全探索
    on_lst =[0]*n
    flag = True
    for j in range(n):
        if (i>>j) & 1:
            on_lst[j] = 1
    for l in range(m): ##　一つ一つの電球について確認
        number = 0
        s = s_lst[l]
        for sw in s:
            if on_lst[sw-1]==1:
                number += 1
        if number%2 != p[i]:
            flag = False
            break
    if flag:
        answer += 1

print(answer)

### FIXED CODE ###

n,m = map(int,input().split())
s_lst = [list(map(int,input().split())) for i in range(m)]
for i in range(m):
    del s_lst[i][0]
p_lst = list(map(int,input().split()))
answer = 0

for i in range(2**n): #各電球がonかoffかビット全探索
    on_lst =[0]*n
    flag = True
    for j in range(n):
        if (i>>j) & 1:
            on_lst[j] = 1
    for l in range(m): ##　一つ一つの電球について確認
        number = 0
        s = s_lst[l]
        for sw in s:
            if on_lst[sw-1]==1:
                number += 1
        if number%2 != p_lst[l]:
            flag = False
            break
    if flag:
        answer += 1

print(answer)
import numpy as np

N = int(input())
s = []
for i in range(N):
  s.append(input())
    
M = int(input())
t = []
for i in range(M):
  t.append(input())
    
s = np.unique(s, return_counts=True)
t = np.unique(t, return_counts=True)

ans = 0
for i,ch_s in enumerate(s[0]):
  ans_tmp = s[1][i]
  for j,ch_t in enumerate(t[0]):
    if ch_s == ch_t:
      ans_tmp -= t[1][j]
    if ans_tmp > ans:
      ans = ans_tmp
print(int(ans))


### FIXED CODE ###

import numpy as np

N = int(input())
s = []
for i in range(N):
  s.append(input())
    
M = int(input())
t = []
for i in range(M):
  t.append(input())

s = np.array(s)
t = np.array(t)
s_uni = np.unique(s)

ans = 0
for i,ch_s in enumerate(s_uni):
  ans_tmp = (s==ch_s).sum()
  ans_tmp -= (t==ch_s).sum()
  if ans_tmp > ans:
    ans = ans_tmp
print(int(ans))
L=[]
i=0
while i <10000:
    L.append(0)
    i+=1
for x0 in range(1,100):
    for y0 in range(1,100):
        for z0 in range(1,100):
            p=x0**2+y0**2+z0**2+x0*y0+y0*z0+z0*x0
            if p<10001:
                L[p]+=1
N=int(input())
for i in range(0,N):
    print(L[i])

### FIXED CODE ###

L=[]
i=0
while i <100001:
    L.append(0)
    i+=1
for x0 in range(1,100):
    for y0 in range(1,100):
        for z0 in range(1,100):
            p=x0**2+y0**2+z0**2+x0*y0+y0*z0+z0*x0
            if p<10001:
                L[p]+=1
N=int(input())
for i in range(1,N+1):
    print(L[i])
n,m = map(int,input().split())
t = [[] for _ in range(n)]
for i in range(m):
    t_1,t_2 = map(int,input().split())
    t[t_1-1].append(t_2)

ans = ""
for i in t:
    if len(set(i)) == 1:
        ans += str(i[0])
    if not i:
        ans += "0"
if ans[0] == "0":
    if n == 1:
        print(0)
    else:
        print(-1)
else:
    print(ans)


### FIXED CODE ###

n,m = map(int,input().split())
t = [[] for _ in range(n)]
for i in range(m):
    t_1,t_2 = map(int,input().split())
    t[t_1-1].append(t_2)

ans = ""
for i in range(n):
    if len(set(t[i])) == 1:
        ans += str(t[i][0])
    elif not t[i]:
        if i == 0:
            if n == 1:
                ans += "0"
            else:    
                ans += "1"
        else:
            ans += "0"
    else:
        print(-1)
        exit()
if ans[0] == "0":
    if n == 1:
        print(0)
    else:
        print(-1)
else:
    print(ans)
r = input()
print(r * r)

### FIXED CODE ###

r = int(input())
print(r * r)
n=int(input())
h=list(map(int,input().split()))
ans=0
answer=[]
for i in range(n-1):
  if h[i]>=h[i+1]:
    ans+=1
  if h[i]<h[i+1]:
    answer.append(ans)
    ans=0
  if i == n-2:
    answer.append(ans)
  else:
    continue
print(max(answer))


### FIXED CODE ###

N = int(input())
H = list(map(int,input().split()))
x = 0
lis = []
for i in range(0,len(H)-1) :
    if H[i] - H[i+1] >=0:
        x += 1
    else:
        lis.append(x)
        x =0
lis.append(x)
print(max(lis))
a, b, c = input().split()
print("YES" if a[-1] == b[1] and b[-1] == c[1] else "NO")

### FIXED CODE ###

a, b, c = input().split()
print("YES" if a.endswith(b[:1]) and b.endswith(c[:1]) else "NO")