luogu#P14574. 批话哥
批话哥
Background

Cynthia hates people who make the fake information, but the computer room is full of Fakers, which makes her very angry.
Problem Description
There are people in the computer room. Today, they held a practice competition with a total of problems. Cynthia recorded events that occurred after the practice contest. The -th event is represented by a triple , meaning that person numbered told Cynthia that their score on problem was . If someone does not tell Cynthia their score on a problem, they are considered to have scored on that problem.
However, the computer room is full of Fakers. If someone tells Cynthia that their score on a problem is , Cynthia will believe they actually scored if ; if ; and otherwise.
You need to help Cynthia calculate everyone's score in her mind.
Input Format
Enter five positive integers in the first line, , as described in the question.
The next lines contain three integers , as described in the question.
Output Format
Output a total of integers in one line, representing the score of each person in Cynthia's mind.
2 2 3 38 65
1 2 48
1 1 85
2 1 32
48 100
Hint
Sample Explanation
Person 1 scored and for the two problems, respectively. Since , in Cynthia's mind, person 1's score is .
Person 2 scored and for the two problems, respectively. Since , and since they did not tell Cynthia their score for the second problem, in Cynthia's mind, person 2's score is .
Data range
| Subtask | Score | |
|---|---|---|
| Subtask 1 | ||
| Subtask 2 | ||
| Subtask 3 |
For of the data, it is guaranteed to meet the following conditions:
- .
- .
- .
- $\forall 1 \leq i < j \leq k,(x_i,y_i) \neq (x_j,y_j)$.