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

N=int(input())
edge=[tuple(i for i in list(map(int,input().split(" ")))) for i in range(N-1)]
graph=[set(i for i in range(1,N+1)) for j in range(N+1)]
a_list=[]
for i,j in edge:
    ans = graph[i]&graph[j]
    a_list.append(min(ans))
    graph[i].remove(min(ans))
    graph[j].remove(min(ans))
print(max(a_list))
for i in a_list:
    print(i)


### FIXED CODE ###

import sys
sys.setrecursionlimit(500000)
N = int(input())
E = [[] for i in range(N + 1)]
for i in range(N - 1):
    a, b = map(int, input().split(' '))
    E[a].append((b, i))
    E[b].append((a, i))
K = max(len(e) for e in E)
print(K)
ans = [-1] * (N - 1)


def dfs(v=1, p=0, p_col=-1):
    col = 1
    for u, idx in E[v]:
        if u != p:
            if col == p_col:
                col += 1
            ans[idx] = col
            dfs(u, v, col)
            col += 1


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

n = int(input())
s = input()

num_rgb = {'R':0, 'G':0, 'B':0}
num_list = []
for i in range(n):
    num_rgb[s[i]] += 1
    num_list.append(num_rgb.copy())

total = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        if s[i] == s[j]:
            continue
        target = ''
        if not (s[i] == 'R' or s[j] == 'R'):
            target = 'R'
        elif not (s[i] == 'G' or s[j] == 'G'):
            target = 'G'
        elif not (s[i] == 'B' or s[j] == 'B'):
            target = 'B'
        num = num_list[n-1][target]-num_list[j][target]
        if 2*j-i < n and s[j+j-i] == target:
            num -= 1
        total += num
print(total)

### FIXED CODE ###

n = int(input())
s = input()
 
num_rgb = {'R':0, 'G':0, 'B':0}
num_list = []
for i in range(n):
    num_rgb[s[i]] += 1
    num_list.append(num_rgb.copy())
 
total = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        if s[i] == s[j]:
            continue
        target = ''
        if not (s[i] == 'R' or s[j] == 'R'):
            target = 'R'
        elif not (s[i] == 'G' or s[j] == 'G'):
            target = 'G'
        elif not (s[i] == 'B' or s[j] == 'B'):
            target = 'B'
        num = num_list[n-1][target]-num_list[j][target]
        if 2*j-i < n and s[j+j-i] == target:
            num -= 1
        total += num
print(total)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys
n, y = map(int,input().split())

for i in range(y // 10000 + 1): #10000円札の枚数
    for j in range(y // 5000 + 1):
        for k in range(y // 1000 + 1):
            if 10000 * i + 5000 * j + 1000 * k == y and i + j + k == n:
                print(i, j, k)
                sys.exit()
print(-1, -1, -1)


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
n, y = map(int,input().split())

for i in range(y // 10000 + 1): #10000円札の枚数
    for j in range(y // 5000 + 1):
        if n - i - j >= 0 and n - i - j == (y - 10000 * i - 5000 * j) / 1000:
            print(i, j, n - i - j)
            sys.exit()
print(-1, -1, -1)
### BUGGY CODE ###

n=int(input())
a=[int(x) for x in input().rstrip().split()]
cnt=[0 for i in range(n)]
nc2=[0 for i in range(n)]
for i in a:
  cnt[i-1]+=1
  nc2[i-1]=((cnt[i-1])*(cnt[i-1]-1))//2

for i in a:
  print(sum(nc2)-nc2[i-1]+((cnt[i-1]-1)*(cnt[i-1]-2))//2)

### FIXED CODE ###

n=int(input())
a=[int(x) for x in input().rstrip().split()]
cnt=[0 for i in range(n)]
for i in a:
  cnt[i-1]+=1

nc2=[]
for i in cnt:
  nc2.append(((i)*(i-1))//2)

All=sum(nc2)
for i in range(n):
  now=cnt[a[i]-1]-1
  print(All-nc2[a[i]-1]+((now)*(now-1))//2)
### BUGGY CODE ###

import sys
def solve():
    readline = sys.stdin.readline

    H, W = map(int, readline().split())
    rW = range(W); rH = range(H)
    S = [readline() for i in rH]

    def gen():
        U = [-1]*W
        V = [0]*W
        for i in rH:
            p = -1
            Si = S[i]
            for j in rW:
                if Si[j] == '#':
                    c = j - p - 1
                    for k in range(p+1, j):
                        V[k] = max(V[k], c)
                    yield V[j] + (i - U[j] - 1)
                    V[j] = 0
                    U[j] = i
                    p = j
            c = W - p - 1
            for k in range(p+1, W):
                V[k] = max(V[k], c)
        for u, v in zip(U, V):
            yield v + (H - u - 1)
    sys.stdout.write("%d\n" % (max(gen()) - 1))
solve()

### FIXED CODE ###

H, W = map(int, input().split())
S = [input() for i in range(H)]
P = [[0]*W for i in range(H)]
Q = [[0]*W for i in range(H)]
for i in range(H):
    p = -1
    for j in range(W):
        if S[i][j] == '#':
            c = j - p - 1
            for k in range(p+1, j):
                P[i][k] = c
            p = j
    c = W - p - 1
    for k in range(p+1, W):
        P[i][k] = c
for j in range(W):
    p = -1
    for i in range(H):
        if S[i][j] == '#':
            c = i - p - 1
            for k in range(p+1, i):
                Q[k][j] = c
            p = i
    c = H - p - 1
    for k in range(p+1, H):
        Q[k][j] = c
ans = 0
for i in range(H):
    for j in range(W):
        if S[i][j] != '#':
            ans = max(ans, P[i][j] + Q[i][j])
print(ans - 1)
### BUGGY CODE ###

from collections import deque
N, K, C = map(int, input().split())
S = input()

fastest = deque([])
latest = deque([])
ans = deque([])


date = 1

for work_days in range(K):
    while S[date - 1] != 'o':
        date += 1
    fastest.append(date)
    date += C + 1

date = 1

for work_days in range(K):
    while S[- date] != 'o':
        date += 1
    latest.appendleft(N - (date - 1))
    date += C + 1
    
for i in range(K):
    if fastest[i] == latest[i]:
        ans.append(fastest[i])

print(*ans)    

### FIXED CODE ###

N, K, C = map(int, input().split())
S = input()

fastest = []
latest = []


date = 1

for work_days in range(K):
    while S[date - 1] == 'x':
        date += 1
    fastest.append(date)
    date += C + 1

date = 1

for work_days in range(K):
    while S[- date] == 'x':
        date += 1
    latest.append(N - (date - 1))
    date += C + 1
    
for i in range(K):
    if fastest[i] == latest[- (i + 1)]:
        print(fastest[i])
### BUGGY CODE ###

def main():
    n,m=map(int,input().split())
    a=list(map(int,input().split()))
    a.sort(reverse=True)
    c=[0,2,5,5,4,5,6,3,7,6]
    cost=[0]*m
    for i,x in enumerate(a):
        cost[i]=c[x]
    dp=[0]*(n+10)
    ans=0
    for i in range(n+1):
        for j in cost:
            dp[i+j]=max(dp[i]+1,dp[i+j])
    cnt=n
    while cnt>0:
        for i,j in enumerate(cost):
            if dp[cnt]==1:
                if j==cnt:
                    ans*=10
                    ans+=a[i]
                    cnt-=j
                    break
            elif dp[cnt-j]==dp[cnt]-1:
                ans*=10
                ans+=a[i]
                cnt-=j
                break
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

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

A.sort()
A.reverse()

match = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

dp = [-N-N] * (N + 1)
dp[0] = 0

for i in range(1, N + 1):
  for j in A:
    if i >= match[j]:
      dp[i] = max(dp[i], dp[i - match[j]] + 1)

max_list = []
while N:
  for j in A:
    if N >= match[j] and dp[N] == dp[N - match[j]] + 1:
      max_list.append(j)
      N -= match[j]
      break

for j in max_list:
  print(j, end="")
print("")
### BUGGY CODE ###

r,g,b,n = map(int, input().split())
count = 0
c0,c1,c2 = sorted([r,g,b])
for i in range(1+n//c2):
    rest1 = n - i*c2
    if rest1 < 0:
        break
    for j in range(1+rest1//c1):
        rest = n - i*c2 - j*c1
        if rest <0:
            break
        if rest%c0 == 0 and rest >= 0:
            count += 1
print(count)

### FIXED CODE ###

r,g,b,n = map(int, input().split())
count = 0
c0,c1,c2 = sorted([r,g,b])
for i in range(1+n//c2):
    rest1 = n - i*c2
    if rest1 < 0:
        break
    for j in range(1+rest1//c1):
        rest = n - i*c2 - j*c1
        if rest <0:
            break
        elif rest%c0 == 0:
            count += 1
print(count)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

def main():
    n,k = map(int,input().split())
    a = list(map(int, input().split()))
    ans = [0 for _ in range(n+1)]
    for _ in range(k):
        ans = [0 for _ in range(n+1)]
        for i in range(n):
            [l,r] = [max(0,i-a[i]),min(n-1,i+a[i])]
            ans[l] += 1
            ans[r+1] -= 1
        for i in range(n):
            ans[i+1] += ans[i]
        a = ans
        if min(ans) >= n:
            print(*[n for _ in range(n)])
            return
    x = []
    for i in range(n):
        x.append(ans[i])
    print(*x)


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    n,k = map(int,input().split())
    a = list(map(int, input().split()))
    ans = [0 for _ in range(n+1)]
    for _ in range(k):
        ans = [0 for _ in range(n+1)]
        for i in range(n):
            [l,r] = [max(0,i-a[i]),min(n-1,i+a[i])]
            ans[l] += 1
            ans[r+1] -= 1
        for i in range(n):
            ans[i+1] += ans[i]
        a = ans
        if ans[0] >= n and ans[n-1] >= n:
            print(*[n for _ in range(n)])
            return
    x = []
    for i in range(n):
        x.append(ans[i])
    print(*x)


if __name__ == "__main__":
    main()
### BUGGY CODE ###

import sys
from collections import defaultdict

class UnionFind:
    def __init__(self, n):
        self.root = [i for i in range(n+1)]
        self.rank = [0] * (n+1)
        self.size = [1] * (n+1)  # The number of nodes under the target node.

    def find(self, x):
        if self.root[x] == x:
            return x
        else:
            y = self.find(self.root[x])
            self.root[x] = y
            return self.root[x]

    def unite(self, x, y):
        rx = self.find(x)
        ry = self.find(y)
        if self.rank[rx] < self.rank[ry]:
            self.root[rx] = ry
            self.size[ry] += self.size[rx]
        else:
            self.root[ry] = rx
            self.size[rx] += self.size[ry]
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1

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

def main():
    input = sys.stdin.readline
    N, K, L = map(int, input().split())
    road = UnionFind(N)
    rail = UnionFind(N)

    for _ in range(K):
        p, q = map(int, input().split())
        road.unite(p-1, q-1)

    for _ in range(L):
        r, s = map(int, input().split())
        rail.unite(r-1, s-1)

    road_r = defaultdict(set)
    rail_r = defaultdict(set)
    for i in range(N):
        road_r[road.find(i)].add(i)
        rail_r[rail.find(i)].add(i)

    memo = [[-1 for _ in range(N)] for _ in range(N)]
    ans = [0 for _ in range(N)]
    for i in range(N):
        n = road.find(i)
        m = rail.find(i)

        if memo[n][m] != -1:
            ans[i] = memo[n][m]
        else:
            a = len(road_r[n] & rail_r[m])
            memo[n][m] = a
            ans[i] = a

    return print(*ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from collections import defaultdict

class UnionFind:
    def __init__(self, n):
        self.root = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    def find(self, x):
        if self.root[x] == x:
            return x
        else:
            y = self.find(self.root[x])
            self.root[x] = y
            return self.root[x]

    def unite(self, x, y):
        rx = self.find(x)
        ry = self.find(y)
        if self.rank[rx] < self.rank[ry]:
            self.root[rx] = ry
        else:
            self.root[ry] = rx
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1

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

def main():
    input = sys.stdin.readline
    N, K, L = map(int, input().split())
    road = UnionFind(N)
    rail = UnionFind(N)

    for _ in range(K):
        p, q = map(int, input().split())
        road.unite(p-1, q-1)

    for _ in range(L):
        r, s = map(int, input().split())
        rail.unite(r-1, s-1)

    d = defaultdict(lambda: 0)
    for i in range(N):
        n = road.find(i)
        m = rail.find(i)
        d[(n, m)] += 1

    ans = []
    for i in range(N):
        n = road.find(i)
        m = rail.find(i)
        ans.append(d[(n, m)])

    return print(*ans)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

K, S = map(int, input().split())
import itertools
count = 0
for pattern in list(itertools.product(range(K+1), repeat=2)):
    #print(pattern)
    if S-K <= sum(pattern) <= S:
        
        count += 1

print(count)

### FIXED CODE ###

K, S = map(int, input().split())
import itertools
count = 0
for pattern in itertools.product(range(K+1), repeat=2):
    #print(pattern)
    if S-K <= sum(pattern) <= S:
        
        count += 1

print(count)
### BUGGY CODE ###

S=input()
Q=int(input())
Rev=False
for _ in range(Q):
    q=list(input().split())
    if len(q)==1:
        Rev=not Rev
    else:
        if q[1]=='1':
            if not Rev:
                S=q[2]+S
            else:
                S=S+q[2]
        else:
            if Rev:
                S=q[2]+S
            else:
                S=S+q[2]
if Rev:
    S=S[::-1]
print(S)

### FIXED CODE ###

S=input()
Q=int(input())
Rev=False
a=[]
b=[]
for _ in range(Q):
    q=list(input().split())
    if len(q)==1:
        Rev=not Rev
    else:
        if q[1]=='1':
            if not Rev:
                a.append(q[2])
            else:
                b.append(q[2])
        else:
            if Rev:
                a.append(q[2])
            else:
                b.append(q[2])
S=''.join(a)[::-1]+S+''.join(b)
if Rev:
    S=S[::-1]
print(S)
### BUGGY CODE ###

s=input()
t=input()
res=0
if len(set(t)-set(s)) > 0:
    res=-1
else:
    dic={}
    for e_t in t:
        dic[e_t]=[]
    for i in range(len(s)):
        if s[i] in t:
            dic[s[i]].append(i+1)
    cur = 0
    for i in range(len(t)):
        nxt=cur
        for e in dic[t[i]]:
            if e > cur:
                nxt=e
                break
        if nxt == cur:
            nxt = dic[t[i]][0]
            res+=len(s)
        cur=nxt
    res+=cur
print(res)

### FIXED CODE ###

s=input()
t=input()
import bisect
res=0
if len(set(t)-set(s)) > 0:
    res=-1
else:
    pos={}
    set_t=set(t)
    for e_t in t:
        pos[e_t]=[]
    for i in range(len(s)):
        if s[i] in set_t:
            pos[s[i]].append(i+1)
    cur = 0
    nxt=0
    for e_t in t:
        nxt=bisect.bisect_left(pos[e_t], cur+1)
        if nxt < len(pos[e_t]):
            cur=pos[e_t][nxt]
        else:
            cur=pos[e_t][0]
            res+=len(s)
    res+=cur
print(res)
### BUGGY CODE ###

def main():
    mod = 998244353

    A, B, C, D = map(int, input().split())

    dp = [0] * B + [pow(A, i, mod) for i in range(D + 1 - B)]
    for a in range(A + 1, C + 1):
        T = [0] * (D + 1)
        for b in range(B, D + 1):
            T[b] = (a * T[b - 1] + b * dp[b] - (a - 1) * (b - 1) * dp[b - 1]) % mod
        dp = T

    print(dp[D])

main()

### FIXED CODE ###

mod = 998244353

A, B, C, D = map(int, input().split())

dp = [0] * (D + 1)
dp[B:D + 1] = [pow(A, i, mod) for i in range(D + 1 - B)]

for a in range(A + 1, C + 1):
    T = [0] * (D + 1)
    for b in range(B, D + 1):
        T[b] = (a * T[b - 1] + b * dp[b] - (a - 1) * (b - 1) * dp[b - 1]) % mod
    dp = T

print(dp[D])
### BUGGY CODE ###

import functools
import operator

func_A = functools.partial(functools.reduce, operator.mul)

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

    ans = func_A(A)
    
    if ans > 10 ** 18:
        print("-1")
    else:
        print(ans)
    
if __name__ == "__main__":
    main()



### FIXED CODE ###

import operator
from functools import reduce

def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    if 0 in A:
        print("0")
        exit()
    
    for i in A:
        ans *= i
        if ans > 10 ** 18:
            print(-1)
            exit()

    
    print(ans)
    
if __name__ == "__main__":
    main()
### BUGGY CODE ###

H, W = map(int, input().split())
obs = [[False for _ in range(W)] for _ in range(H)]
for y in range(H):
    s = input()
    for x in range(W):
        obs[y][x] = (s[x] == '#')

inc_x = [[0 for _ in range(W)] for _ in range(H)]
cnt_x = [[0 for _ in range(W)] for _ in range(H)]
for y in range(H):
    for x in range(W):
        if obs[y][x]: 
            inc_x[y][x]= 0
        elif x == 0 or obs[y][x-1]:
            inc_x[y][x] = 1
        else:
            inc_x[y][x] = inc_x[y][x-1] + 1
    for x in reversed(range(W)):
        if obs[y][x]:
            cnt_x[y][x]= 0
        elif x == W-1 or obs[y][x+1]:
            cnt_x[y][x] = inc_x[y][x]
        else:
            cnt_x[y][x] += cnt_x[y][x+1]

inc_y = [[0 for _ in range(W)] for _ in range(H)]
cnt_y = [[0 for _ in range(W)] for _ in range(H)]
for x in range(W):
    for y in range(H):
        if obs[y][x]: 
            inc_y[y][x]= 0
        elif y == 0 or obs[y-1][x]:
            inc_y[y][x] = 1
        else:
            inc_y[y][x] = inc_y[y-1][x] + 1
    for y in reversed(range(H)):
        if obs[y][x]:
            cnt_y[y][x]= 0
        elif y == H-1 or obs[y+1][x]:
            cnt_y[y][x] = inc_y[y][x]
        else:
            cnt_y[y][x] += cnt_y[y+1][x]


cnt = [[cnt_x[y][x]+cnt_y[y][x]-1 for x in range(W)] for y in range(H)]
ans = max([max(cnt[y]) for y in range(H)])
print(ans)


### FIXED CODE ###

H, W = map(int, input().split())
obs = [[False for _ in range(W)] for _ in range(H)]
for y in range(H):
    s = input()
    for x in range(W):
        obs[y][x] = (s[x] == '#')

inc_x = [[0 for _ in range(W)] for _ in range(H)]
cnt_x = [[0 for _ in range(W)] for _ in range(H)]
for y in range(H):
    for x in range(W):
        if obs[y][x]: 
            inc_x[y][x]= 0
        elif x == 0 or obs[y][x-1]:
            inc_x[y][x] = 1
        else:
            inc_x[y][x] = inc_x[y][x-1] + 1
    for x in reversed(range(W)):
        if obs[y][x]:
            cnt_x[y][x]= 0
        elif x == W-1 or obs[y][x+1]:
            cnt_x[y][x] = inc_x[y][x]
        else:
            cnt_x[y][x] += cnt_x[y][x+1]

inc_y = [[0 for _ in range(W)] for _ in range(H)]
cnt_y = [[0 for _ in range(W)] for _ in range(H)]
for x in range(W):
    for y in range(H):
        if obs[y][x]: 
            inc_y[y][x]= 0
        elif y == 0 or obs[y-1][x]:
            inc_y[y][x] = 1
        else:
            inc_y[y][x] = inc_y[y-1][x] + 1
    for y in reversed(range(H)):
        if obs[y][x]:
            cnt_y[y][x]= 0
        elif y == H-1 or obs[y+1][x]:
            cnt_y[y][x] = inc_y[y][x]
        else:
            cnt_y[y][x] += cnt_y[y+1][x]


cnt = [[cnt_x[y][x]+cnt_y[y][x]-1 for x in range(W)] for y in range(H)]
ans = max([max(cnt[y]) for y in range(H)])
print(ans)
### BUGGY CODE ###

from math import factorial
import sys

sys.setrecursionlimit(2000)
n, k = map(int, input().split())

memo = {}
def combination(n,k):
  if n < k:
    return 0
  if n / 2 < k:
    k = n - k
  if (n,k) in memo:
    return memo[(n,k)]
  elif k == 0:
    return memo.setdefault((n,k), 1)
  elif k == 1:
    return memo.setdefault((n,k), n)
  else:
    return memo.setdefault((n,k), combination(n-1,k) + combination(n-1,k-1))

for i in range(1, k + 1):
  print(combination(n-k+1,i)*combination(k-1,i-1)%(10**9+7))


### FIXED CODE ###

from math import factorial
import sys

sys.setrecursionlimit(2000)
mod = 10**9+7
n, k = map(int, input().split())

memo = {}
def combination(n,k):
  if n < k:
    return 0
  return factorial(n)//factorial(k)//factorial(n-k)
  if n / 2 < k:
    k = n - k
  if n in memo and k in memo[n]:
    return memo[n][k]
  v = 0
  if k == 0:
    v = 1
  elif k == 1:
    v = n
  else:
    v = combination(n-1,k) + combination(n-1,k-1)
  return memo.setdefault(n, {}).setdefault(k, v)

for i in range(1, k + 1):
  print(combination(n-k+1,i)*combination(k-1,i-1)%mod)
### BUGGY CODE ###

import copy
N, Q = map(int, input().split())
s = str(input())
TD = [list(map(str, input().split())) for i in range(Q)]

# どんどん合体していくことだけはわかった
hash = {}
for i in range(N):
    if s[i] in hash.keys():
        hash[s[i]].append(i)
    else:
        hash[s[i]] = [i]

ans = 0
for t, d in TD:
    if t not in hash.keys():
        continue
    if d == 'R':
        r_list = map(lambda x: x+1, hash[t])
        hash[t] = []
        for r in r_list:
            if 0 <= r <= N-1:
                hash[s[r]].append(r)
            else:
                ans += 1
    else:
        l_list = map(lambda x: x-1, hash[t])
        hash[t] = []
        for l in l_list:
            if 0 <= l <= N - 1:
                hash[s[l]].append(l)
            else:
                ans += 1


print(N - ans)

### FIXED CODE ###

N, Q = map(int, input().split())
S = str(input())
TD = [list(map(str, input().split())) for i in range(Q)]


def disappear(index, place):
    if index == -1:
        return (False, False)
    else:
        left = False
        right = False
        for t, d in TD:
            cur_chara = place[index]
            if t == cur_chara:
                if d == 'R':
                    index += 1
                else:
                    index -= 1
                if index < 0:
                    left = True
                    break
                elif index > N-1:
                    right = True
                    break
        return (left, right)


def binarySearch(place, direction):
    """
    :param direction; left, right
    :return: 消失する位置
    """
    start, end = -1, N
    if direction == 'left':
        while end - start > 1:
            t = start + (end - start) // 2
            if disappear(t, place)[0]:
                start = t
            else:
                end = t
        return start
    elif direction == 'right':
        while end - start > 1:
            t = start + (end - start) // 2
            if disappear(t, place)[1]:
                end = t
            else:
                start = t
        return start


left = binarySearch(S, direction='left')
right = binarySearch(S, direction='right')
print(right - left)
### BUGGY CODE ###

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

for i in range(n):
    print(a.count(i + 1))


### FIXED CODE ###

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

ans = [0]* n

for i in a:
    ans[i - 1] += 1
    
for i in range(n):
    print(ans[i])