Time limit per test: 0.25
Memory limit: 65536
Some time ago Vasya was cleaning up the garret. After the hours of hard work he suddenly found the notes of the totalizator,
which his grandfather had organised during the XII Berland football championship. It followed from the notes that each participant
of the totalizator made his prediction about the result of every match (the result of the match is an ordered pair of numbers — number of goals
scored by the first team and number of goals scored by the second team). Each prediction is such pair of numbers too. Every participant got score
for the every prediction he made by the following rules:
- if he guesses the winner (or a tie), his score is inscreased by 2.
- if he guesses the difference between the number of goals scored by the first and the second team, his score is inscreased by 3.
- if he guesses the number of goals scored by the first team, his score is increased by 1.
- if he guesses the number of goals scored by the second team, his score is increased by 1.
So, if the participant guesses the exact result of the match, he gets 7 points. Or, for example, if he guesses only the winner and
the difference, he scores 5 points. Unfortunately, the list with the results of the totalizator was lost. But Vasya wants
to know how many scores each totalizator participant got. Help him to find the scores.
The first line contains two integer numbers n
(1 ≤ n
≤ 100, 1 ≤ m
≤ 100) —
the number of participants and the number of games. After it m
blocks of n
+1 lines follow. Each block corresponds to one match.
The first line of each block contains two integer numbers a
(0 ≤ a
≤ 10) — numbers of goals scored by the first and
the second team. Other n
lines of each block contain predictions of all participants in the same format, the i
-th line is a prediction
of the i
numbers separated by spaces — scores of participants. The i
-th number should be the score of the i
Participants are numbered from 1 to n
as their predictions are given in the input.