#P12248. Football League Points Calculation

    ID: 14354 Type: Default 1000ms 256MiB

Football League Points Calculation

Football League Points Calculation

In W City, there are $n$ teams numbered from $1$ to $n$. In each season, a total of $m$ matches are played between the teams. For the $i$-th match, team $a_i$ plays against team $b_i$ with a score of $c_i : d_i$. The results are determined as follows:

  • If $c_i > d_i$, then team $a_i$ wins and earns $3$ points.
  • If $c_i < d_i$, then team $b_i$ wins and earns $3$ points.
  • If $c_i = d_i$, both teams earn $1$ point each.

After all $m$ matches have been played, compute the total points for each team.

inputFormat

The first line contains two integers $n$ and $m$, representing the number of teams and the number of matches respectively.

Each of the next $m$ lines contains four integers $a_i$, $b_i$, $c_i$, $d_i$, describing a match.

outputFormat

Output $n$ integers separated by a space, where the $i$-th integer is the total points accumulated by team $i$ after all matches.

sample

3 3
1 2 2 1
2 3 0 0
1 3 1 3
3 1 4