<|instruction|>
Solve the below problem. The solution should start with an abridged problem statement. Then key observations. Then full solution based on the observations. Then C++ and Python implementations with comments.

405. Totalizator
Time limit per test: 0.25 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard

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.
Input
The first line contains two integer numbers n and m (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,b (0 ≤ a,b ≤ 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-th participant.
Output
Output n numbers separated by spaces — scores of participants. The i-th number should be the score of the i-th participant. Participants are numbered from 1 to n as their predictions are given in the input.
Example(s)
sample input
sample output
1 2
3 2
2 1
0 2
0 0
6

sample input
sample output
2 3
4 3
2 2
2 0
0 0
1 1
1 0
5 0
3 0
2 0
8 6

<|response|>
1) Abridged problem statement
- There are n participants and m football matches.
- For each match, the actual score (a, b) is given, followed by n predictions (p_i, q_i).
- Scoring per prediction:
  - +2 if the outcome (win/draw/loss) is correct.
  - +3 if the goal difference (a − b) is correct.
  - +1 if a is guessed exactly.
  - +1 if b is guessed exactly.
- Output the total score for each participant after all matches.

2) Key observations
- The four checks are independent; points add up for each that is satisfied.
- If the goal difference is correct, then the outcome is also correct (including the draw case), and both bonuses (+3 and +2) are awarded.
- Constraints are tiny (n, m ≤ 100), so a direct O(n·m) implementation is trivial and fast.
- No special edge cases beyond correctly handling draws and differences.

3) Full solution approach
- Read n and m.
- Initialize an array scores[0..n-1] to 0.
- For each of the m matches:
  - Read actual result (a, b).
  - For each participant i from 0 to n−1:
    - Read predicted (p, q).
    - Initialize add = 0.
    - Outcome correct if:
      - (a > b and p > q) or (a < b and p < q) or (a == b and p == q): add += 2.
    - Difference correct if (a − b) == (p − q): add += 3.
    - First team goals correct if a == p: add += 1.
    - Second team goals correct if b == q: add += 1.
    - scores[i] += add.
- Print scores separated by spaces.

Complexity:
- Time: O(n·m) comparisons, at most 10,000 checks; negligible.
- Memory: O(n) for the scores (streaming input processing).

4) C++ implementation with detailed comments
```cpp
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m;
    if (!(cin >> n >> m)) return 0;

    vector<int> scores(n, 0);

    for (int match = 0; match < m; ++match) {
        int a, b;            // Actual goals for team1 and team2
        cin >> a >> b;

        for (int i = 0; i < n; ++i) {
            int p, q;        // Prediction by participant i
            cin >> p >> q;

            int add = 0;

            // Outcome correct? (win/draw/loss)
            if ((a > b && p > q) || (a < b && p < q) || (a == b && p == q)) {
                add += 2;
            }

            // Goal difference correct?
            if ((a - b) == (p - q)) {
                add += 3;
            }

            // Exact goals per team?
            if (a == p) add += 1;
            if (b == q) add += 1;

            scores[i] += add;
        }
    }

    // Output scores separated by spaces (no trailing space)
    for (int i = 0; i < n; ++i) {
        if (i) cout << ' ';
        cout << scores[i];
    }
    cout << '\n';
    return 0;
}
```

5) Python implementation with detailed comments
```python
import sys

def main():
    data = list(map(int, sys.stdin.buffer.read().split()))
    if not data:
        return
    it = iter(data)

    n = next(it)
    m = next(it)

    scores = [0] * n

    for _ in range(m):
        a = next(it)  # actual goals team 1
        b = next(it)  # actual goals team 2

        for i in range(n):
            p = next(it)  # predicted goals team 1
            q = next(it)  # predicted goals team 2

            add = 0

            # Outcome correct? (win/draw/loss)
            if (a > b and p > q) or (a < b and p < q) or (a == b and p == q):
                add += 2

            # Goal difference correct?
            if (a - b) == (p - q):
                add += 3

            # Exact goals per team?
            if a == p:
                add += 1
            if b == q:
                add += 1

            scores[i] += add

    print(' '.join(map(str, scores)))

if __name__ == "__main__":
    main()
```