CF131E Yet Another Task with Queens
Description
A queen is the strongest chess piece. In modern chess the queen can move any number of squares in any horizontal, vertical or diagonal direction (considering that there're no other pieces on its way). The queen combines the options given to the rook and the bishop.
There are $ m $ queens on a square $ n×n $ chessboard. You know each queen's positions, the $ i $ -th queen is positioned in the square $ (r_{i},c_{i}) $ , where $ r_{i} $ is the board row number (numbered from the top to the bottom from 1 to $ n $ ), and $ c_{i} $ is the board's column number (numbered from the left to the right from 1 to $ n $ ). No two queens share the same position.
For each queen one can count $ w $ — the number of other queens that the given queen threatens (attacks). For a fixed attack direction only the first queen in this direction is under attack if there are many queens are on the ray of the attack. Obviously, for any queen $ w $ is between 0 and 8, inclusive.
Print the sequence $ t_{0},t_{1},...,t_{8} $ , where $ t_{i} $ is the number of queens that threaten exactly $ i $ other queens, i.e. the number of queens that their $ w $ equals $ i $ .
Input Format
The first line of the input contains a pair of integers $ n,m $ ( $ 1
Output Format
Print the required sequence $ t_{0},t_{1},...,t_{8} $ , separating the numbers with spaces.