Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import collections
import math

N = int(input())

word_dict = []
num = []

for i in range(N):
    s = [i for i in input()]
    count = collections.Counter(s)
    if count in word_dict:
        num[word_dict.index(count)] += 1
    else:
        word_dict.append(count)
        num.append(0)

ans = 0

for i in num:
    i += 1
    if i >= 3:
        ans = ans + (math.factorial(i) // (math.factorial(i - 2) * math.factorial(2)))
    elif i == 2:
        ans += 1
    else:
        continue

print(ans)


### FIXED CODE ###

import collections
import math

N = int(input())
word_dict = {}

ans = 0

for _ in range(N):
    s = input()
    s = "".join(sorted(s))
    if s in word_dict:
        ans += word_dict[s]
        word_dict[s] += 1
    else:
        word_dict[s] = 1
    
print(ans)
### BUGGY CODE ###

N,M=map(int,input().split())
List = list(map(int,input().split()))
for i in range(M):
    MaxY = max(List) 
    Y = List.index(MaxY)
    List[Y] = MaxY //2
Sum = 0
for j in range(N):
    Sum += List[j]
print(Sum)

### FIXED CODE ###

import heapq

n, m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)  

for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_min//2))  
print(-sum(a))
### BUGGY CODE ###

N = int(input())
I = [x for x in range(1,N+1)]
P = [x for x in range(1,N+1)]
del P[0]
P.append(1)
M = [x % y for (x,y) in zip(I,P)]
print(sum(M))

### FIXED CODE ###

N = int(input())
ans = N*(N-1)//2
print(ans)
### BUGGY CODE ###

# 左の文字を決め打ちして、右の文字を試していく 右の文字の候補の位置はあらかじめdicで記録

from collections import defaultdict
pos = defaultdict(list)

import sys
readline = sys.stdin.readline

N = int(readline())
S = readline().rstrip()

for i in range(N):
  pos[S[i]].append(i)

import bisect
def find_tar(s,i): # i + 1文字目以降からsを探す
#  print("pos[s]",pos[s],"から",i+1,"番目以降の最小値を探す")
  j = bisect.bisect_left(pos[s],i+1)
  if j == len(pos[s]):
    return None
  return pos[s][j:] # 全リストを返す

ans = 0
i = 0
while i < N:
  rest = find_tar(S[i],i)
  if rest is None:
    i += 1
    continue
  bestfit = 1
#  print(S[i],rest)
  for j in rest:
    # i,jに同じ文字がある状態
    fit = 1
#    print("i",i,S[i],"j",j,S[j],"からスタート")
    while i + fit < j and j + fit < N:
      if S[i + fit] == S[j + fit]:
#        print("fit",fit,"一致",S[i + fit])
        fit += 1
      else:
        break
    if bestfit < fit:
      bestfit = fit
    if bestfit > ans:
      ans = bestfit
#  print("i",i,"を",i + bestfit,"まで進める")
  i += 1 # i += bestfit

print(ans)

### FIXED CODE ###

import sys
readline = sys.stdin.readline

N = int(readline())
S = readline().rstrip()

def zalgo(S):
  N = len(S)
  res = [0] * N
  res[0] = N
  i = 1
  j = 0
  while i < N:
    while i + j < N and S[j] == S[i + j]:
      j += 1
    res[i] = j
    if j == 0:
      i += 1
      continue
    k = 1
    while i + k < N and k + res[k] < j:
      res[i + k] = res[k]
      k += 1
    i += k
    j -= k
  return res

res = 0
for i in range(N):
  T = S[i:]
  lcp = zalgo(T)
  for j in range(len(T)):
    l = min(lcp[j],j)
    if res < l:
      res = l

print(res)
### BUGGY CODE ###

import heapq
 
N,M = map(int,input().split())
Price_List = list(map(lambda x:x*(-1),map(int,input().split())))
heapq.heapify(Price_List)
for i in range(M):
    heapq.heapify(Price_List)
    val = heapq.heappop(Price_List)* -1 // 2 * -1
    heapq.heappush(Price_List,val)
print(-sum(Price_List))

### FIXED CODE ###

import bisect
 
N,M = map(int,input().split())
Price_List = list(map(int,input().split()))
Price_List.sort()
for i in range(M):
    New_Price = Price_List.pop(-1)//2
    Price_List.insert(bisect.bisect(Price_List,New_Price),New_Price)
print(sum(Price_List))
### BUGGY CODE ###

class UnionFind():
    def __init__(self, n):
        self.parent = [-1 for _ in range(n)]
        # 正==子: 根の頂点番号 / 負==根: 連結頂点数

    def find(self, x):
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def unite(self, x, y):
        x, y = self.find(x), self.find(y)
        if x == y:
            return False
        else:
            if self.size(x) < self.size(y):
                x, y = y, x
            self.parent[x] += self.parent[y]
            self.parent[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        x = self.find(x)
        return -self.parent[x]


h, w = map(int, input().split())
s = tuple(input() for _ in range(h))

uf_v = UnionFind(h * w)
uf_h = UnionFind(h * w)

for r in range(h):
    for c in range(w):
        if s[r][c] == '#': continue
        for dr in (-1, 1):
            nr = r + dr
            if 0 <= nr < h:
                if s[nr][c] == '.':
                    x = r * w + c
                    nx = nr * w + c
                    uf_v.unite(x, nx)
        for dc in (-1, 1):
            nc = c + dc
            if 0 <= nc < w:
                if s[r][nc] == '.':
                    x = r * w + c
                    nx = r * w + nc
                    uf_h.unite(x, nx)

ans = 0
for r in range(h):
    for c in range(w):
        x = r * w + c
        ans = max(ans, uf_v.size(x) + uf_h.size(x) - 1)
print(ans)


### FIXED CODE ###

import sys

input = sys.stdin.readline

H, W = map(int, input().split())
s = [input() for _ in range(H)]

row_blocks = []
for r in range(H):
    t = []
    x = 0
    for c in range(W):
        if s[r][c] == '.':
            x += 1
        else:
            x = 0
        t.append(x)

    x = 0
    for i in range(W - 1, -1, -1):
        if t[i] > 0:
            x = max(x, t[i])
        else:
            x = 0
        t[i] = x
    row_blocks.append(t)
# print(row_blocks)

col_blocks = []
for c in range(W):
    t = []
    x = 0
    for r in range(H):
        if s[r][c] == '.':
            x += 1
        else:
            x = 0
        t.append(x)

    x = 0
    for i in range(H - 1, -1, -1):
        if t[i] > 0:
            x = max(x, t[i])
        else:
            x = 0
        t[i] = x
    col_blocks.append(t)
# print(col_blocks)

ans = 0
for r in range(H):
    for c in range(W):
        t = row_blocks[r][c] + col_blocks[c][r] - 1
        ans = max(ans, t)
print(ans)
### BUGGY CODE ###

# coding: utf-8

n, m = [int(x) for x in input().split()]
xx = []
yy = []
zz = []

for _ in range(n):
    x, y, z = [int(x) for x in input().split()]
    xx.append(x)
    yy.append(y)
    zz.append(z)

result_points = []

for k in range(8):
    max_point = 0
    selected_indexes = []
    for i in range(m):
        max_plus_point = 0
        max_index = 0
        for j in range(n):
            if j in selected_indexes:
                continue
            plus_point = 0
            if k % 2 == 1:
                plus_point += xx[j]
            else:
                plus_point -= xx[j]
            if (k // 2) % 2 == 1:
                plus_point += yy[j]
            else:
                plus_point -= yy[j]
            if (k // 4) % 2 == 1:
                plus_point += zz[j]
            else:
                plus_point -= zz[j]
            if plus_point > max_plus_point:
                max_index = j
                max_plus_point = plus_point
        max_point += max_plus_point
        selected_indexes.append(max_index)
    result_points.append(max_point)

print(max(result_points))


### FIXED CODE ###

# coding: utf-8

n, m = [int(x) for x in input().split()]
xx = []
yy = []
zz = []

for _ in range(n):
    x, y, z = [int(x) for x in input().split()]
    xx.append(x)
    yy.append(y)
    zz.append(z)

result_points = []

results = []

for i in range(8):
    results.append([])
    for j in range(n):
        plus_point = 0
        if i % 2 == 1:
            plus_point += xx[j]
        else:
            plus_point -= xx[j]
        if (i // 2) % 2 == 1:
            plus_point += yy[j]
        else:
            plus_point -= yy[j]
        if (i // 4) % 2 == 1:
            plus_point += zz[j]
        else:
            plus_point -= zz[j]
        results[i].append(plus_point)
    results[i].sort()
    results[i].reverse()

result_points = []

for i in range(8):
    result_points.append(sum(results[i][0:m]))

print(max(result_points))
### BUGGY CODE ###

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

md = []
for i in range(0,N):
  d, m = map(int, input().split())
  md.append({"m":m, "d":d-1})

md = sorted(md, key=lambda x:x["m"], reverse=True)

sh = [0]*M
ans = 0
for x in md:
  idx = x["d"]
  while idx < M :
    if sh[idx] == 0:
      if idx + 1 < M and sh[idx+1]!= 0:
        sh[idx] = sh[idx+1]
        sh[x["d"]] = sh[idx+1]
      else:
        sh[idx] = idx+1
        sh[x["d"]] = idx+1
      ans += x["m"]
      break
    else:
      idx = sh[idx]
print(ans)

### FIXED CODE ###

def insertHeap(array, val):
    array.append(val)
    n = len(array)-1
    while n != 0:
        parent = int((n - 1) / 2)
        if array[n] > array[parent]:
            tmp = array[n]
            array[n] = array[parent]
            array[parent] = tmp
            n = parent
        else:
            break
    return array

def desertHeap(array):
    if array == []:
      return None
    array[0], array[-1] = array[-1], array[0]
    res = array.pop(-1)
    n = len(array)
    if n == 0 or n == 1: 
      return res
    parent = 0
    while True:
        child = 2 * parent + 1
        if child >= n: break
        if (child + 1 < n) and array[child] < array[child + 1]:
            child += 1
        if array[parent] < array[child]:
            array[child], array[parent] = array[parent], array[child]
            parent = child;
        else:
            break
    return res

n, m = map(int, input().split())
 
li = [[] for j in range(10**5+1)]
 
for _ in range(n):
  a, b = map(int, input().split())
  li[a].append(b)
 
ans = 0
jobsHeap = []
for i in range(1, m+1):
  for val in li[i]:
    jobsHeap = insertHeap(jobsHeap, val)
  
  if jobsHeap != []:
    res = desertHeap(jobsHeap)
    ans += res
print(ans)
### BUGGY CODE ###

n = int(input())
A = list(map(int,input().split()))
m = max(A)

ans = 0
for i in range(n):
    if A[i] <= 2*10**5-i:
        a = A[i]
        ato = i+a
        saigo = n
        if i+m+A[i]+1 < n:
            saigo = i+m+A[i]+1
        if i+a > n:
            ato = n
        for j in range(ato,saigo):
            if j-i == A[i]+A[j]:
                ans += 1

print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
 
X = dict()
ans = 0
for i in range(N):
    L = i + A[i]
    if L not in X:
        X[L] = 1
    else:
        X[L] += 1

for j in range(N):
    R = j - A[j]
    if R in X:
        ans += X[R]

print(ans)
### BUGGY CODE ###

n = int(input())

d = list(map(int,input().split()))

ans = 0

k_m = max(d)

for i in range(1, k_m+1):
    abc = 0
    arc = 0
    for j in d:
        if j >= i:
            arc += 1
        elif j < i:
            abc += 1

    if arc == abc:
        ans += 1

print(ans)

### FIXED CODE ###

n = int(input())

d = sorted(list(map(int,input().split())))

print(d[n//2] - d[n//2-1])
### BUGGY CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = ['No' for i in range(n - k)]

pre = 1
cur = 1
for i in range(k):
    pre *= a[i]

for i in range(1, n - k + 1):
    for j in range(i, i + k):
        cur *= a[j]

    if cur > pre:
        ans[i - 1] = 'Yes'

    pre = cur
    cur = 1


for i in ans:
    print(i)


### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = ['No' for i in range(n - k)]


for i in range(n - k):
    if a[i] < a[i + k]:
        ans[i] = 'Yes'


for i in ans:
    print(i)
### BUGGY CODE ###

N, Q = (int(i) for i in input().split())
S = input()

AC_list = [0] * N
 
for i in range(N-1):
    if(S[i+1]=="C"):
        if(S[i]=="A"):
            AC_list[i] = 1

for i in range(Q):
    l, r = (int(_) for _ in input().split())
    if(AC_list[r-1]==1 and S[r]=="C"):
        print(sum(AC_list[l-1:r])-1)
    else:
        print(sum(AC_list[l-1:r]))



### FIXED CODE ###

N, Q = (int(i) for i in input().split())
S = input()

AC_list = [0] * (N+1)
 
val=0
for i in range(N-1):
    if(S[i+1]=="C"):
        if(S[i]=="A"):
            val +=1

    AC_list[i+1] = val
AC_list[i+2] = val

for i in range(Q):
    l, r = (int(_) for _ in input().split())
    if(r!=N):
        if(S[r-1]=="A" and S[r]=="C"):
            print(AC_list[r]-AC_list[l-1]-1)
        else:
            print(AC_list[r]-AC_list[l-1])
    else:
        print(AC_list[r]-AC_list[l-1])
### BUGGY CODE ###

N, M = map(int, input().split())
L = [0] * M
R = [0] * M
for i in range(M):
    L[i], R[i] = map(int, input().split())

sum = 0
for id in range(1, N+1):
    for li, ri in zip(L, R):
        if id < li or ri < id:
            break
    else:
        sum += 1

print(sum)


### FIXED CODE ###

N, M = map(int, input().split())
L = [0] * M
R = [0] * M
for i in range(M):
    L[i], R[i] = map(lambda x: int(x)-1, input().split())

sum = 0
maxl = max(L)
minr = min(R)
for id in range(N):
    if maxl <= id and id <= minr:
        sum += 1

print(sum)
### BUGGY CODE ###

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

a = [int(input()) for i in range(n[2])]

for i in range(n[0]):
    if n[1]-(n[2]-a.count(i+1)) <= 0:
        print('No')
    else:
        print('Yes')


### FIXED CODE ###

import collections
n = list(map(int,input().split()))

a = [int(input()) for i in range(n[2])]
kk = n[1]-n[2]


counter = collections.Counter(a)

for i in range(n[0]):
    if kk+counter[i+1] <= 0:
        print('No')
    else:
        print('Yes')
### BUGGY CODE ###

n,q = map(int,input().split())
s = input()
lr = [tuple(map(int,input().split())) for _ in range(q)]
for i in range(q):
  temp = s[lr[i][0]-1:lr[i][1]]
  cnt =0
  j = -1
  while True:
    j = temp.find('AC', j+1)
    if j == -1:
      break
    cnt += 1
  print(cnt)

### FIXED CODE ###

n,q = map(int,input().split())
s = input()

ac = [0] * (n - 1)
for i in range(n-1):
  if s[i] == 'A' and s[i+1] == 'C':
    ac[i] = 1

acc = [0] * n
for i in range(n-1):
  acc[i+1] = acc[i] + ac[i]

lr = [tuple(map(int,input().split())) for _ in range(q)]
for i in range(q):
  l = lr[i][0] - 1
  r = lr[i][1] - 1
  print(acc[r] - acc[l])
### BUGGY CODE ###

import sys

sys.setrecursionlimit(10**7)

def dfs(x):
    if seen[x-1]==0:
        uni[cnt].add(x)
        seen[x-1]=1
        for i in fri[x-1]:
            dfs(i)
    

n,m,k=map(int,input().split())

fri=[[] for i in range(n)]
blk=[set() for i in range(n)]

for i in range(m):
    a,b=map(int,input().split())
    fri[a-1].append(b)
    fri[b-1].append(a)

for i in range(k):
    c,d=map(int,input().split())
    blk[c-1].add(d)
    blk[d-1].add(c)


seen=[0 for i in range(n)]

uni=[]
cnt=0
for i in range(1,n+1):
    if seen[i-1]==0:
        uni.append(set())
        dfs(i)
        cnt+=1

seq=[0 for i in range(n)]

for unii in uni:
    for j in unii:
        cj=len(unii)-len(fri[j-1])-len(unii&blk[j-1])-1
        seq[j-1]=cj

print(*seq)


### FIXED CODE ###

import sys

sys.setrecursionlimit(10**7)

def dfs(x):
    if seen[x-1]==0:
        uni[cnt].add(x)
        seen[x-1]=1
        for i in fri[x-1]:
            dfs(i)
    

n,m,k=map(int,input().split())

fri=[[] for i in range(n)]
blk=[[] for i in range(n)]

for i in range(m):
    a,b=map(int,input().split())
    fri[a-1].append(b)
    fri[b-1].append(a)

for i in range(k):
    c,d=map(int,input().split())
    blk[c-1].append(d)
    blk[d-1].append(c)


seen=[0 for i in range(n)]

uni=[]
cnt=0
for i in range(1,n+1):
    if seen[i-1]==0:
        uni.append(set())
        dfs(i)
        cnt+=1

seq=[0 for i in range(n)]

for unii in uni:
    for j in unii:
        cj=len(unii)-len(fri[j-1])-len(unii&set(blk[j-1]))-1
        seq[j-1]=cj

print(*seq)
### BUGGY CODE ###

if __name__ == '__main__':
    N, M = map(int, input().split())

    p_and_y = list()
    prefMap = {}
    for i in range(M):
        P, Y = map(int, input().split())

        p_and_y.append((P, Y))

        if P in prefMap:
            prefMap[P].append(Y)
        else:
            prefMap[P] = [Y]

    for shiList in prefMap.values():
        shiList.sort()

    for P, Y in p_and_y:
        left = str(P).zfill(6)

        right = prefMap[P].index(Y) + 1
        right = str(right).zfill(6)

        print(left + right)


### FIXED CODE ###

if __name__ == '__main__':
    N, M = map(int, input().split())

    ans = [None] * M
    prefMap = {}
    for i in range(M):
        P, Y = map(int, input().split())

        if P in prefMap:
            prefMap[P].append((Y, i))
        else:
            prefMap[P] = [(Y, i)]

    for P, L in prefMap.items():
        L.sort()

        for j, (y, i) in enumerate(L):
            ans[i] = str(P).zfill(6) + str(j + 1).zfill(6)

    print("\n".join(ans))
### BUGGY CODE ###

b=input()
n=len(b)
while "10" in b or "01"in b:
    b=b.replace("01","")
    b=b.replace("10","")
print(n-len(b))


### FIXED CODE ###

b=input()
A=b.count("1")
B=b.count("0")
print(min(2*A,2*B))
### BUGGY CODE ###

n, m = map(int, input().split())
ls = []
for i in range(m):
    l, r = map(int, input().split())
    ln = l
    while r >= ln:
        ls.append(ln)
        ln += 1
ls_duplicate = [x for x in set(ls) if ls.count(x) > (m-1)]
print(len(ls_duplicate))


### FIXED CODE ###

n, m = map(int, input().split())
snum = 0
bnum = 100000
for i in range(m):
    l, r = map(int, input().split())
    if l >= snum:
        snum = l
    if r <= bnum:
        bnum = r
if snum > bnum:
    print(0) 
else:
    print(bnum - snum + 1)
### BUGGY CODE ###

N, P = [int(_c) for _c in input().split(" ")]

if N == 1:
    print(P)
else:
    _max = 1
    M = int(P ** (1 / N) + 1)
    for i in range(1, M + 1):
        if P % (i ** N) == 0:
            _max = i

    print(_max)

### FIXED CODE ###

N, P = [int(_c) for _c in input().split(" ")]

if N == 1:
    print(P)
else:
    _max = 1
    M = int(P ** (1 / N) + 1.0 * 1e-9)
    for i in range(1, M + 1):
        if P % (i ** N) == 0:
            _max = i

    print(_max)
### BUGGY CODE ###

from collections import Counter

N = int(input())
S = [input() for n in range(N)]

S = Counter(S)

k_list = [ k for k, v in S.items() if v == max(S.values())]

for k in sorted(k_list):
    print(k)


### FIXED CODE ###

from collections import Counter

N = int(input())
S = [input() for n in range(N)]

S = Counter(S)
max_val = max(S.values()) 
k_list = [ k for k, v in S.items() if v == max_val]

for k in sorted(k_list):
    print(k)
### BUGGY CODE ###

n,k=map(int, input().split())
p = list(map(int, input().split()))
a = [0 for i in range(n-k+1)]
for i in range(n-k+1):
    a[i]=(sum(p[i:i+k]))
print((max(a)+k)/2)


### FIXED CODE ###

n,k=map(int,input().split())
p=list(map(int,input().split()))
r=[0]
for i in range(n):
    r.append(r[i]+p[i])
p=0
for i in range(k,n+1):
    p=max(p,r[i]-r[i-k])
print('{:.10f}'.format((p+k)/2))
### BUGGY CODE ###

from functools import reduce

N, result = eval(input()), 1
List = list(map(int, input().split()))
result = reduce(lambda x, y: x * y, List[:N])
print(result if result <= 10**18 else -1)

### FIXED CODE ###

n = int(input())
List = list(map(int, input().split()))
res = 1
if 0 in List:
    print(0)
    quit()
for x in List:
    res *= x
    if res > 10**18:
        print(-1)
        quit()
print(res)
### BUGGY CODE ###

# coding: utf-8
import itertools
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
d = sum(v) - sum(c)
maxd = d if d > 0 else 0
for m in range(1, n):
    a0 = [i for i in list(itertools.combinations(list(range(n)), m))]
    for a1 in a0:
        d = sum([v[j] - c[j] for j in a1])
        if maxd < d:
            maxd = d
print(maxd)


### FIXED CODE ###

# coding: utf-8
import itertools
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
d = sum([v[i] - c[i] for i in range(n) if v[i] - c[i] > 0])
print(d)
### BUGGY CODE ###

MOD = 10 ** 9 + 7

n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(60):
    x = 0
    now = 0
    for j in range(n):
        if (a[j] >> i) & 1:
            x += 1
        now = x * (n - x) % MOD
    now = now * (2 ** i) % MOD
    ans = (ans + now) % MOD

print(ans)


### FIXED CODE ###

import numpy as np
MOD = 10 ** 9 + 7

n = int(input())
a = np.array(list(map(int, input().split())))
l = len(bin(max(a))) - 2

ans = 0
for i in range(l):
    b = (a >> i) & 1
    x = np.count_nonzero(b)
    now = x * (n - x) * pow(2, i, MOD) % MOD
    ans += now

print(ans % MOD)
### BUGGY CODE ###

N,M = map(int,input().split())
L = [[0] * N for i in range(N)]
for i in range(M):
    A,B = map(int,input().split())
    L[A-1][B-1] = 1
    L[B-1][A-1] = 1
ans = [0] * N
from queue import Queue
q = Queue()
for i in range(N):
    if L[0][i] == 1:
        ans[i] = 1
        q.put(i)
while not q.empty():
    k = q.get()
    for i in range(1,N):
        if L[k][i] == 1:
            if ans[i] == 0:
                ans[i] = k+1
                q.put(i)
flag = True
for i in range(1,N):
    if ans[i] == 0:
        flag = False
        print('No')
        break
if flag == True:
    print('Yes')
    for i in range(N-1):
        print(ans[i+1])

### FIXED CODE ###

N,M = map(int,input().split())
L = [[] for i in range(N)]
for i in range(M):
    A,B = map(int,input().split())
    L[A-1].append(B-1)
    L[B-1].append(A-1)
ans = [0] * N
visit = [0] * N
visit[0] = 1
from queue import Queue
q = Queue()
q.put(0)
while not q.empty():
    current = q.get()
    for a in L[current]:
        if visit[a] == 0:
            visit[a] = visit[current] + 1
            ans[a] = current + 1
            q.put(a)
        else:
            if visit[a] > visit[current] + 1:
                visit[a] = visit[current] + 1
                ans[a] = current + 1
flag = True
for i in range(1,N):
    if ans[i] == 0:
        flag = False
        print('No')
        break
if flag == True:
    print('Yes')
    for i in range(N-1):
        print(ans[i+1])
### BUGGY CODE ###

from collections import deque
n,m = map(int,input().split())
es = [[] for _ in range(n+1)]
for _ in range(m):
    u,v = map(int,input().split())
    es[u].append(v)
to = [[] for _ in range(n+1)]
for i in range(1, n+1):
    que = deque([])
    for j in es[i]:
        que.append((j, 1))
    while que:
        v,c = que.popleft()
        if c > 3:
            continue
        elif c==3:
            if v  not in to[i]:
                to[i].append(v)
        else:
            for j in es[v]:
                que.append((j, c+1))
s,t = map(int,input().split())
visited = [False]*(n+1)
que = deque([])
for st in to[s]:
    que.append((st, 1))
ans = -1
while que:
    v,c = que.popleft()
    if visited[v]:
        continue
    elif v==t:
        ans = c
        break
    else:
        visited[v] = True
        for nx in to[v]:
            que.append((nx,c+1))
print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
if m==0:
    print(-1)
    exit()
es = [[] for _ in range(n+1)]
for _ in range(m):
    u,v = map(int,input().split())
    es[u].append(v)
s,t = map(int,input().split())

INF = 10**9
dist = [[INF,INF,INF] for _ in range(n+1)]

d = 0
q = [s]

while q:
    d += 1
    r = d%3
    qq = []
    for u in q:
        for v in es[u]:
            if dist[v][r] == INF:
                dist[v][r] = d
                qq.append(v)
    q = qq

d = dist[t][0]
print(-1 if d==INF else d//3)
### BUGGY CODE ###

n, x, y = map(int, input().split())
array = []

for i in range(1, n+1):
    for j in range(i+2, n+1):
        array.append(min(j-i, abs(x-i)+1+abs(y-j), abs(y-i)+1+abs(x-j)))

print(n)
for k in range(2, n):
    print(array.count(k))

### FIXED CODE ###

n, x, y = map(int, input().split())
array = [0]*(n-1)

for i in range(1, n+1):
    for j in range(i+2, n+1):
        array[min(j-i, abs(x-i)+1+abs(y-j), abs(y-i)+1+abs(x-j))-1] += 1

print(n)
for k in range(1, n-1):
    print(array[k])