Harryxun/stf_run huggingface dataset:
S = input()
g=input()
f = list(g)
h =set(f)
k = list(h)
if len(h)==1:
  print('No')
else :
  print('Yes')

### FIXED CODE ###

g=input()
f = list(g)
h =set(f)
k = list(h)
if len(h)==1:
  print('No')
else :  
  print('Yes')
S = list(input())
l = [S.pop()]

while S:
    if S[-1] != l[-1]:
        l.append(S.pop())
    else:
        if len(S) == 1:
            break
        else:
            a = S.pop()
            b = S.pop()
            l.append(b + a)
    print(l)

print(len(l))

### FIXED CODE ###

S = list(input())
l = [S.pop()]

while S:
    if S[-1] != l[-1]:
        l.append(S.pop())
    else:
        if len(S) == 1:
            break
        else:
            a = S.pop()
            b = S.pop()
            l.append(b + a)

print(len(l))
import sys
input=sys.stdin.buffer.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
def primes(n):#nまでの素数を列挙
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,int(n**(0.5)+1)):
        if not is_prime[i]:
            continue
        for j in range(i*2,n+1,i):
            is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
A,B = map(int,input().split())
if A == 1 or B == 1:
    print(1)
else:
    Min = min(A,B)
    print(Min)
    pr = primes(Min)
    c = 0
    for i in pr:
        if A%i == 0 and B%i == 0:
            c += 1
    print(c+1)

### FIXED CODE ###

import sys
input=sys.stdin.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
import fractions
A,B = map(int,input().split())
if A == 1 or B == 1:
    print(1)
else:
    def factorization(n): #2以上の整数n => [[素因数, 指数], ...]の2次元リストを返す
        arr = []
        temp = n
        for i in range(2, int(-(-n**0.5//1))+1):
            if temp%i==0:
                cnt=0
                while temp%i==0:
                    cnt+=1
                    temp //= i
                arr.append([i, cnt])
        if temp!=1:
            arr.append([temp, 1])
        if arr==[]:
            arr.append([n, 1])
        return arr
    c = fractions.gcd(A,B)
    arr = factorization(c)
    print(len(arr)+1)
from math import factorial
import sys
sys.setrecursionlimit(10000000)

N, K = map(int, input().split())
MOD=10**9+7

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    #if (n,r) in nCr: return nCr[(n,r)]
    #nCr[(n,r)] = cmb(n-1,r)%MOD + cmb(n-1,r-1)%MOD
    #return nCr[(n,r)]
    a = factorial(n)%MOD / factorial(r)%MOD / factorial(n - r)%MOD
    return int(a)

presum=0
for i in range(1,K+1):
    tmp=cmb(N-K+i, i)%MOD
    ans=(tmp-presum)*cmb(K-1, i-1)%MOD
    presum += ans
    print(ans)

### FIXED CODE ###


N, K = map(int, input().split())
MOD=10**9+7

def cmb(n, r):
    if n < r: return 0 #date added
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

for i in range(1,K+1):
    ans=cmb(N-K+1, i)%MOD*cmb(K-1, i-1)%MOD
    # cmb(N-K+i, i) -> cmb(N-K+1, i)
    #if N==K and 1 < i: ans=0
    print(int(ans%MOD))
N = int(input())
A = list(map(int, input().split()))
t = 0
def exist_odd(A):
  for i in A:
    if i % 2 == 1:
      break
    return 1
  else:
    return 0
while exist_odd(A) ==1:
  A = list(map(lambda x: x / 2, A))
  t = t+1
print(t)

### FIXED CODE ###

s = input()
print(int(s[0])+int(s[1])+int(s[2]))
n = int(input())
from math import gcd
cou = 0
for i in range(1,int(n**0.5)+1):
  if n%i==0:
    b = n//i-1
    if n//b==n%b:
      cou += b
    
    if i>2:
      c = i-1
      if n//c==n%c:
        cou += c
print(cou)

### FIXED CODE ###

n = int(input())
from math import gcd
cou = 0
for i in range(1,int(n**0.5)+1):
  if n%i==0:
    b = n//i-1
    if b>=2 and n//b==n%b:
      cou += b
    
    if i>2:
      c = i-1
      if n//c==n%c:
        cou += c
print(cou)
N,M = map(int,input().split())
a = []
for i in range(M):
    a.append(int(input()))

def fibo(x2):
    if (x2 == 1) or (x2 == 2):
        return (1)
    else:
        return((fibo(x2-1) + fibo(x2-2)) % (10**9 + 7))

aa = [] #aの差を取ったもののリスト
for k in range(M-1):
    aa.append(a[k+1] - a[k] - 1)
print(aa)
#aa.append(N - a(M))

if 0 in aa:
    ans = 0

else:
    ans = 1
    ans_list = []
    for i in range(M-1):
        if aa[i] >= 1:
            ans_list.append(fibo(aa[i]))

    ans_list.append(fibo(a[0]))
    ans_list.append(fibo(N - a[M-1]))
    print(ans_list)
    
    for i in range (len(ans_list)):
        ans = (ans * ans_list[i]) % (10**9 + 7)

print(ans)


### FIXED CODE ###

N,M = map(int,input().split())
a = []
if M >= 1:
    for i in range(M):
        a.append(int(input()))

def fibo(n):
    a, b = 1, 1
    if (n == 0) or (n == 1) or (n == 2):
        return 1
    else:
        for _ in range(n-2):
            a, b = b, a + b
        return b

aa = [] #aの差を取ったもののリスト
if M >= 2:
    for k in range(M-1):
        aa.append(a[k+1] - a[k] - 1)
#print(aa)
#aa.append(N - a(M))

    if 0 in aa:
        ans = 0

    else:
        ans = 1
        ans_list = []
        for i in range(M-1):
            ans_list.append(fibo(aa[i]))

        ans_list.append(fibo(a[0]))
        ans_list.append(fibo(N - a[M-1]))
    #print(ans_list)
    
        for i in range (len(ans_list)):
            ans = (ans * ans_list[i]) % (10**9 + 7)

elif M == 1:
    ans_list = []
    ans_list.append(fibo(a[0]))
    ans_list.append(fibo(N - a[0]))
    ans = (ans_list[0] * ans_list[1]) % (10**9 + 7)

elif M == 0:
    ans = fibo(N+1) % (10**9 + 7)

print(ans)
def solve(L,R,d):
    count = 0
    for i in range(L,R+1):
        if i % d == 0:
            count += 1
    return count
L, R, D = map(int, input().split())
print(solve(L,R,d))

### FIXED CODE ###

def solve(L,R,d):
    count = 0
    for i in range(L,R+1):
        if i % d == 0:
            count += 1
    return count
L, R, d = map(int, input().split())
print(solve(L,R,d))
while True:
	a = ""
	b = ""
	H, W = map(int, input().split())

	if (H == 0 and W == 0) : break
	for i in range(W):
		if (i % 2 == 0) : a = a + "#"
		else : a = a + "."
	for i in range(W):
		if (i % 2 == 0) : b = b + "."
		else : b = b + ???#???

	for j in range(H):
		if j % 2 == 0: print(a)
		else : print(b)

	print()

### FIXED CODE ###

while True:
	a = ""
	b = ""
	H, W = map(int, input().split())

	if H == 0 and W == 0 : break

	for i in range(W):
		if i % 2 == 0 : a = a + "#"
		else : a = a + "."
	for i in range(W):
		if i % 2 == 0 : b = b + "."
		else : b = b + "#"

	for j in range(H):
		if j % 2 == 0: print(a)
		else : print(b)

	print()
from collections import deque

def dfs(xs):
    print("xs",xs)
    x = xs.popleft()

    if len(xs) == 0:
        return x

    # not +
    xs2 = xs.copy()
    y   = xs2.popleft()
    xy  = int(str(x)+str(y))
    xs2.appendleft(xy)
    b = dfs(xs2)

    # has +
    a = x * 2 + dfs(xs)


    return a+b


s  = str(input())
xs = list(map(int,s))
xs = deque(xs)

print(dfs(xs))

### FIXED CODE ###

import sys
import copy
from collections import deque

sys.setrecursionlimit(1000000000)

def dfs(xs,q):
    if len(xs) == 0:
        return sum(int(i) for i in q)

    x = xs.popleft()

    if len(q) == 0:
        q.append(x)
        return dfs(xs,q)


    a1 = copy.copy(xs)
    a2 = copy.copy(xs)

    q1 = copy.copy(q)
    q2 = copy.copy(q)

    q1.append(x)

    y  = q2.pop()
    yx = y + x
    q2.append(yx)

    return dfs(a1,q1) + dfs(a2,q2)


s  = str(input())
xs = deque(list(s))

print(dfs(xs,deque([])))
a, 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)
w, a, b = map(int, input().split())

if b + w < a:
    print(a - (b + w))
elif a <= b + w <= a + w:
    print(0):
elif a <= b <= a + w:
    print(0)
elif a + w < b:
    print(b- (a + w))

### FIXED CODE ###

w, a, b = map(int, input().split())

if b + w < a:
    print(a - (b + w))
elif a <= b + w <= a + w:
    print(0)
elif a <= b <= a + w:
    print(0)
elif a + w < b:
    print(b - (a + w))
N = int(input())
As = list(map(int, input().split()))

hs = []
ls = []

i = 0
if As[1] > As[0]:
  ls.append((As[0],0))
  f = 1
elif As[1] < As[0]:
  hs.append((As[0],0))
  f = 0
else:
  fl = 1
  for j in range(2,N):
    if As[j] > As[0]:
      ls.append((As[0],0))
      f = 1
      i = j
      fl = 0
      break
    elif As[j] < As[0]:
      hs.append((As[0],0))
      f = 0
      i = j
      fl = 0
      break
  if fl == 1:
    print(1000)
    exit()
  
while i < N-1:
  if f == 1 and As[i] > As[i+1]:
    hs.append((As[i],i))
    f = 0
  elif f == 0 and As[i] < As[i+1]:
    ls.append((As[i],i))
    f = 1
  i += 1
    
if As[N-2] < As[N-1]:
  hs.append((As[N-1],N-1))
elif As[N-2] > As[N-1]:
  ls.append((As[N-1],N-1))

if len(ls) == 1 and len(hs) == 1 and ls[0][1] > hs[0][1]:
  print(1000)
  exit()
if ls[0][1] > hs[0][1]:
  del hs[0]
if hs[-1][1] < ls[-1][1]:
  del ls[-1]

### FIXED CODE ###

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

rlt = 1000
for i in range(N-1):
  if As[i+1] > As[i]:
    rlt = (As[i+1]-As[i])*(rlt//As[i]) + rlt
    
print(rlt)
n = int(input())
enemy = list(map(int, input().split()))
beat = list(map(int, input().split()))

def hoge(index, index1):
	if(index == 0 and index1 == 0):
		return min([enemy[0], beat[0]])
	elif(index1 - index == 1):
		return min([enemy[index1], beat[index] - hoge(index, index)])
	else:
		return min([enemy[index] - hoge(index - 1, index), beat[index] ])
  
res = 0
for i in range(n):
	res += hoge(i, i) + hoge(i, i+1)
print(res)


### FIXED CODE ###

n = int(input())
enemy = list(map(int, input().split()))
beat = list(map(int, input().split()))
ans = 0 
for i in range(n):
  #左を全力で倒す
  left = min([enemy[i], beat[i]])
  ans += left
  enemy[i] -= left
  beat[i] -= left
  
  right = min([enemy[i+1], beat[i]])
  ans += right
  enemy[i + 1] -= right
  beat[i] -= right
  
print(ans)
n=int(input())
S=str(input())
s=list(S)
i=1
while True:
    if i > n:
        break
    if s[i-1]==s[i]:
        s.pop(i)
        n -= 1
    else:
        i +=1

print(len(s))


### FIXED CODE ###

n=int(input())
S=str(input())
s=list(S)
i=1
while True:
    if n ==1 or n==0:
        break
    if s[i-1]==s[i]:
        s.pop(i)
        n -= 1
    else:
        i +=1
    if i >= n:
        break
print(len(s))
s = input()

if len(s) == 6 & s[2]==s[3] & s[4]== s[5] {
    return print("Yes")
}else {
    return print("No")
}

### FIXED CODE ###

s = input()

if len(s) == 6 and s[2]==s[3] and s[4]== s[5]:
    print("Yes")
else:
    print("No")
import sys
input=sys.stdin.readline

a,b,c,d=map(int,input())
s=[1,-1]
f=['+','-']
for i in range(2):
    for j in range(2):
        for k in range(2):
            if a+b*s[i]+c*s[j]+d*s[k]==7:
                    print(str(a)+f[i]+str(b)+f[j]+str(c)+f[k]+str(d)+'=7')
                    exit()

### FIXED CODE ###

a,b,c,d=map(int,input())
s=[1,-1]
f=['+','-']
for i in range(2):
    for j in range(2):
        for k in range(2):
            if a+b*s[i]+c*s[j]+d*s[k]==7:
                    print(str(a)+f[i]+str(b)+f[j]+str(c)+f[k]+str(d)+'=7')
                    exit()
# B-Checkpoints
# 問題URL:http://abc057.contest.atcoder.jp/tasks/abc057_b

N, M = map(int, input().split()) #まずNとMを取得
ABs = [] # 学生のいる座標
CDs = [] #　チェックポイントの座標

# 2行目よりN行分学生の座標を取得してABsに格納
for i in range(N):
    ABs.append([int(x) for x in input().split()])

# 2+N行目よりM行分チェックポイントの座標を取得してCDsに格納
for i in range(N):
    CDs.append([int(x) for x in input().split()])

for a,b in ABs:
    #ABsの中身をa,b、CDsの中身をc,dとして取り出し各チェックポイントごとの距離を測定
    distance = [abs(a-c) + abs(b-d) for c,d in CDs]
    
    #　距離が同じ場合は最も番号が早いものを出力する。=(min()はもともとそのようにできている。早いもの優先）
    #+1はリストは0番目から、チェックポイントは1番目から始まるため
    print(distance.index(min(distance)) + 1)

### FIXED CODE ###

# B-Checkpoints
# 問題URL:http://abc057.contest.atcoder.jp/tasks/abc057_b

N, M = map(int, input().split()) #まずNとMを取得
ABs = [] # 学生のいる座標
CDs = [] #　チェックポイントの座標

# 2行目よりN行分学生の座標を取得してABsに格納
for i in range(N):
    ABs.append([int(x) for x in input().split()])

# 2+N行目よりM行分チェックポイントの座標を取得してCDsに格納
for i in range(M):
    CDs.append([int(x) for x in input().split()])

for a,b in ABs:
    #ABsの中身をa,b、CDsの中身をc,dとして取り出し各チェックポイントごとの距離を測定
    distance = [abs(a-c) + abs(b-d) for c,d in CDs]
    
    #　距離が同じ場合は最も番号が早いものを出力する。=(min()はもともとそのようにできている。早いもの優先）
    #+1はリストは0番目から、チェックポイントは1番目から始まるため
    print(distance.index(min(distance)) + 1)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 15 16:58:00 2019

@author: YudNK
"""
import heapq as hp
import bisect as bs

N, Q = map(int, input().split())
E = []
for i in range(N):
    s, t, x = map(int, input().split())
    app = [s - x, 1, x]
    rem = [t - x, -1, x]
    E.append(app)
    E.append(rem)
D = [int(input()) for i in range(Q)]
E.sort(key = lambda x:x[0])

ans = []
stopX = []

for j in range(len(E)):
    while D[0] < E[j][0]:
        if len(stopX) == 0:
            ans.append(-1)
            hp.heappop(D)
        else:
            ans.append(stopX[0])
            hp.heappop(D)
    if E[j][1] == 1:
        hp.heappush(stopX, E[j][2])
    else:
        index = bs.bisect_left(stopX,E[j][2])
        stopX.pop(index)

while len(ans) != Q:
    ans.append(-1)
[print(i) for i in ans]

### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 15 16:58:00 2019

@author: YudNK
"""
import bisect as bs

N, Q = map(int, input().split())
E = []
for i in range(N):
    s, t, x = map(int, input().split())
    a = [s - x, t - x, x] #イベント
    E.append(a)
E.sort(key = lambda x: x[2])
D = []
for i in range(Q):
    D.append(int(input()))

ans = [-1]*Q
check = [-1]*Q

for e in E:
    l = bs.bisect_left(D, e[0])
    r = bs.bisect_left(D, e[1])
    while l < r:
        if check[l] == -1:  
            ans[l] = e[2]
            check[l] = r
            l += 1
        else:
            l = check[l]
        
[print(i) for i in ans]
N = int(input())
C = list(map(int, input().split()))
C.sort(reverse = True)
#print(C)
sosu = 10 ** 9 + 7
kake = (2 ** N) % sosu
ans = 0
for i in range(N):
    #for j in range(1,circle):##j番目に大きい
    #    kkk = c(i, j-1) * 2 ** (N-i-1)###i+1番目に大きいものがj番目に大きくなるような選び方
    #    ans += C[i] * kake * j * kkk
    ans += C[i] * kake * (2 ** i + i * 2 ** (i-1)) * 2 ** (N-i-1)
    ans %= sosu
print(int(ans))







### FIXED CODE ###

N = int(input())
C = list(map(int, input().split()))
C.sort(reverse = True)
#print(C)
sosu = 10 ** 9 + 7
K = dict()
K[-1] = 1
K[0] = 1
for i in range(1, N+1):
    a = K[i-1] * 2 % sosu
    K[i] = a
ans = 0
for i in range(N):
    #for j in range(1,circle):##j番目に大きい
    #    kkk = c(i, j-1) * 2 ** (N-i-1)###i+1番目に大きいものがj番目に大きくなるような選び方
    #    ans += C[i] * kake * j * kkk
    ans += (C[i] * K[N] * (K[i] + i * K[i-1]) * K[N-i-1]) % sosu
    ans %= sosu
print(int(ans))
import math
N=int(input())
A = [ int(input()) for _ in range(N) ]
ans = A[0]
for x in A[1:]:
  ans = ans * x // math.gcd(ans, x)
print(ans)


### FIXED CODE ###


def gcd(a, b):
  if b == 0:
    return a
  else:
    return gcd(b, a % b)

N=int(input())
A = [ int(input()) for _ in range(N) ]
ans = A[0]
for x in A[1:]:
  ans = ans * x // gcd(ans, x)
print(ans)
import itertools
import math
n=int(input())
l=list(map(int,input().split()))
c = list(itertools.combinations(l, 3))
count=0
r=math.factorial(len(l)) // (math.factorial(len(l) - 3) * 6)
print(r)
for i in range(r):
    if c[i][0]==c[i][1] or c[i][1]==c[i][2] or c[i][2]==c[i][0]:
        pass
    else:
        if c[i][0]+c[i][1]>c[i][2] and c[i][1]+c[i][2]>c[i][0] and c[i][2]+c[i][0]>c[i][1]:
            count+=1
        else:
            pass
print(count)

### FIXED CODE ###

import itertools
import math
n=int(input())
l=list(map(int,input().split()))
if len(l)<=2:
    print('0')
else:
    c = list(itertools.combinations(l, 3))
    count=0
    r=math.factorial(len(l)) // (math.factorial(len(l) - 3) * 6)
    for i in range(r):
        if c[i][0]==c[i][1] or c[i][1]==c[i][2] or c[i][2]==c[i][0]:
            pass
        else:
            if c[i][0]+c[i][1]>c[i][2] and c[i][1]+c[i][2]>c[i][0] and c[i][2]+c[i][0]>c[i][1]:
                count+=1
            else:
                pass
    print(count)
n = int(input())
a = list(map(int, input().split()))
dp = [[[-1] * (10 ** 4) for _ in range(n)] for _ in range(2)]
dp[0][0][1000] = 0
dp[1][0][1000] = 0
for i in range(n):
    for j in range(10 ** 4):
        dp[0][i + 1][j], dp[1][i + 1][j] = dp[0][i][j], dp[1][i][j]
    for j in range(10 ** 4):
        u, v = dp[0][i][j], dp[1][i][j]
        if max(u, v) < 0:
            continue
        dp[0][i + 1][j] = u
        dp[1][i + 1][j] = v
        # print(i, j, u, v)
        dp[0][i + 1][j + max(u, v) * a[i]] = 0
        dp[1][i + 1][j % a[i]] = max(u, v) + j // a[i]
ans = 0
for j in range(10 ** 4):
    if dp[0][n][j] != -1 or dp[1][n][j] != -1:
        ans = max(ans, j)
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
c = 1000
for i in range(1, n):
    if a[i] > a[i - 1]:
        c = c // a[i - 1] * a[i] + c % a[i - 1]
print(c)
N, M = map(int, input().split())
A = list(map(int, input().split()))
vote_sum = sum(A)
cnt = 0
y = "Yes"
n = "No"

for i in range(N):
	if (A[i]*4*M) >= vote_sum:
		cnt += 1
	if cnt == M:
		print(y)
		
if C < M:
	print(n)

### FIXED CODE ###

from collections import deque
K = int(input())

q = deque([i for i in range(1, 10)])

for i in range(K):
    x = q.popleft()
    amari = x%10
    if amari == 0:
        l, m = 10*x, 10*x+1
        q.append(l)
        q.append(m)
    elif amari == 1:
        l, m, r = x*10, x*10+1, x*10+2
        q.append(l)
        q.append(m)
        q.append(r)
    elif amari == 9:
        l, m = 10*x+8, 10*x+9
        q.append(l)
        q.append(m)
    else:
        l, m, r = 10*x+(amari-1), 10*x+(amari), 10*x+(amari+1)
        q.append(l)
        q.append(m)
        q.append(r)

print(x)
print(r ** 2)

### FIXED CODE ###

r = input()
print(int(r) ** 2)
def dfs(node,paths,dp,vis):
    vis[node]=True
    for i in range(0, len(paths[node])):
        if not vis[paths[node][i]]:
            dfs(paths[node][i],paths,dp,vis)
        dp[node]=max(dp[node],1+dp[paths[node][i]])
n,m=map(int,input().split())
paths=[[] for _ in range(n+1)]
for _ in range(m):
    a,b=map(int,input().split())
    paths[a].append(b)
dp,vis=[0]*(n+1),[False]*(n+1)
for i in range(1,n+1):
    if not vis[i]:
        dfs(i,paths,dp,vis)
print(max(dp))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10000000)
def dfs(node,paths,dp,vis):
    vis[node]=True
    for i in range(0, len(paths[node])):
        if not vis[paths[node][i]]:
            dfs(paths[node][i],paths,dp,vis)
        dp[node]=max(dp[node],1+dp[paths[node][i]])
n,m=map(int,input().split())
paths=[[] for _ in range(n+1)]
for _ in range(m):
    a,b=map(int,input().split())
    paths[a].append(b)
dp,vis=[0]*(n+1),[False]*(n+1)
for i in range(1,n+1):
    if not vis[i]:
        dfs(i,paths,dp,vis)
print(max(dp))
import numpy as np
n,m=map(int,input().split())
a=np.zeros(n)
b=np.zeros(n)
for i in range(n):
    a[i],b[i]=map(int,input().split())
x=np.argsort(a)
ans=0
i=0
while m>0:
    ans+=a[x[i]]*min(b[x[i]],m)
    i+=1
    m-=b[x[i]]
print(round(ans))
    

### FIXED CODE ###

import numpy as np
n,m=map(int,input().split())
a=np.zeros(n)
b=np.zeros(n)
for i in range(n):
    a[i],b[i]=map(int,input().split())
x=np.argsort(a)
ans=0
i=0
while m>0:
    ans+=a[x[i]]*min(b[x[i]],m)
    m-=b[x[i]]
    i+=1
print(int(ans))
H, W, N = int(input()) * 3
x = max(H, W)
print((N+x-1)//x)

### FIXED CODE ###

from math import ceil

H = int(input())
W = int(input())
N = int(input())

print(ceil(N/(max(W, H))))
N, M = map(int, input().split())
A = map(int, input().split())

print(max(N -sum(A), -1))

### FIXED CODE ###

print(int(input())*2*3.14)
a = int(input())

b = []

for i in range(a):
    b.append(int(input()))

b.sort()

c = []

if a % 2 == 0:
  k = a//2
else:
  k = a//2+1

bb = b[0:k]

bbb = b[k:]

j = len(bb)-1
jj = len(bbb)
bbb.reverse()
i = 0
ii = 0
c.append(bb[-1])
for llll in range(a-1):
    if i != j and ii != jj:
        p = abs(c[-1]-bb[i])
        pp = abs(c[-1]-bbb[ii])
        if max(abs(c[-1]-bb[i]),abs(c[-1]-bbb[ii])) == p:
            c.append(bb[i])
            c.append(bbb[ii])
            i += 1
            ii += 1
        else:
            c.append(bbb[ii])
            c.append(bb[i])
            i += 1
            ii += 1
    elif i == j:
        c.append(bbb[ii])
        ii += 1
    elif ii == jj:
        c.append(bb[i])
        i += 1

su = 0
for i in range(a-1):
    su += abs(c[i]-c[i+1])
print(su)


### FIXED CODE ###

import sys,bisect as bs,collections as cl,heapq as hq
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n = onem()
a = []
for i in range(n):
    a.append(onem())
a.sort()
bbb = a[n//2+(n%2):]
bbb.reverse()

bbbb = a[n//2:]

if len(bbb) >= 3:
    bbbb = [bbbb[0]] + bbbb[2:] + [bbbb[1]]


aaa = a[:n//2+(n%2)]
if len(aaa) >= 3:
    aaa = [aaa[-1]] + aaa[:-2] + [aaa[-2]]

aaaa = a[:n//2]

lll = []
llll = []

for i in range(n):
    if i % 2 == 0:
        lll.append(aaa[i//2])
        llll.append(bbbb[i//2])
    else:
        lll.append(bbb[i//2])
        llll.append(aaaa[i//2])
ans = 0
an = 0
for i in range(n):
    if i == 0:
        st = lll[0]
        stt = llll[0]
    else:
        ans += abs(lll[i] - st)
        st = lll[i]
        an += abs(llll[i] - stt)
        stt = llll[i]
print(max(ans,an))
n,k=map(int,input().split())
p=[]
for i in range(n):
  x=int(input())
  p.append(x)
p.sort()
y=0
for i in range(k):
  y=y+p[i]
print(y)

### FIXED CODE ###

n,k=map(int,input().split())
p=[]
a,*b=map(int,input().split())
p.append(a)
for i in range(len(b)):
    p.append(b[i])
p.sort()
y=0
for i in range(k):
    y=y+p[i]
print(y)
li = list(map(input().split()))
count = 0

for i in range(3):
    if li[i] == "1":
        count = count + 1

print(count)

### FIXED CODE ###

a = input()

count = 0

for i in range(3):
    temp = a[i]
    if temp == "1":
        count = count + 1

print(count)
n,k = map(int, input().split())
s = []
ans = 0
for i in range(k-1):
  d = int(input())
  for j in range(d):
    s.append(input().split())
for i in range(1,k):
  if s.count(i) == 0:
    ans += 1
print(ans)

### FIXED CODE ###

n , k = map(int,input().split())
ans = [0] * n
for i in range(k):
  d = int(input())
  for j in list(map(int,input().split())):
    ans[j-1] = 1
print(ans.count(0))