P15852 [Lanqiao Cup 2nd International Contest] Rock-Paper-Scissors.

Description

Alice, Bob, and Cindy are playing a game of rock-paper-scissors. Similar to rock-paper-scissors played by two people, in each round, each of them chooses one move from rock, scissors, and paper. The basic winning rules are: rock beats scissors, scissors beats paper, and paper beats rock. If in a round the players can be split into a winning side and a losing side, then every player on the losing side must pay \$1 to every player on the winning side. If the players cannot be split into a winning side and a losing side, then no one pays any money. For example, if Alice plays rock, and Bob and Cindy both play paper, then Alice must pay Bob \$1 and also pay Cindy \$1. For another example, if Alice plays rock, Bob plays scissors, and Cindy plays paper, then no one pays any money. They played a total of $n$ rounds. Ask how much money each person earns in net in the end, i.e., earned money minus paid money.

Input Format

The first line contains an integer $n$, meaning the game is played for a total of $n$ rounds. The next $n$ lines each contain three integers, representing the moves played by Alice, Bob, and Cindy in one round. $0$ means rock, $1$ means scissors, and $2$ means paper.

Output Format

Output three integers, one per line, representing the net money earned by Alice, Bob, and Cindy.

Explanation/Hint

### Constraints For all test cases, $1 \leq n \leq 100$. Translated by ChatGPT 5