PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#FW0000045. Bạn của bạn (Friends of Friends)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Bạn của bạn (Friends of Friends)

Friends of Friends

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

For each person in an undirected friendship network, count other people who are not directly friends but share at least one mutual friend.

Input

Integers n,mn,m followed by mm undirected friendship edges u,vu,v.

Output

Print nn lines, one friends-of-friends count per person.

Subtasks

  • Subtask 1 (40 points): n≤7n\le7; 1≤n≤101\le n\le10, 0≤m≤n(n−1)/20\le m\le n(n-1)/2; distinct undirected edges, no loops, 1-indexed vertices.
  • Subtask 2 (60 points): 1≤n≤101\le n\le10, 0≤m≤n(n−1)/20\le m\le n(n-1)/2; distinct undirected edges, no loops, 1-indexed vertices.

Examples

Input

3 2
1 2
2 3

Output

1
0
1

Explanation

People 1 and 3 have a common friend 2 and are not direct friends, giving each one friend-of-friend. Person 2 already knows both directly.