A guy named Vasya attends the final grade of a high school. One day Vasya decided to…
- User
A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. Next day the teacher got very angry at Vasya and decided to teach him a lesson. He gave the lazy student a seemingly easy task: You are given an idle body in space and the forces that affect it. The body can be considered as a material point with coordinates (0; 0; 0). Vasya had only to answer whether it is in equilibrium. "Piece of cake" — thought Vasya, we need only to check if the sum of all vectors is equal to 0. So, Vasya began to solve the problem. But later it turned out that there can be lots and lots of these forces, and Vasya can not cope without your help. Help him. Write a program that determines whether a body is idle or is moving by the given vectors of forces. Input
The first line contains a positive integer n (1 ≤ n ≤ 100), then follow n lines containing three integers each: the xi coordinate, the yi coordinate and the zi coordinate of the force vector, applied to the body ( - 100 ≤ xi, yi, zi ≤ 100).
Output
Print the word "YES" if the body is in equilibrium, or the word "NO" if it is not.
Examples
Input
3 4 1 7 -2 4 -1 1 -5 -3
Output
NO
Input
3 3 -1 7 -5 2 -4 2 -1 -3
Output
YES
Assistant
We are asked to write a solution in python. The problem: given n vectors, sum their components and check if all sums are zero. Simple.
Implementation: read n, then sum_x, sum_y, sum_z = 0,0,0; loop n times, read three ints, add to sums. At end, if sums all zero -> YES else NO.
Edge cases: n=1, if vector zero -> YES else NO.
We'll produce final answer.
But note: the problem statement is from Codeforces 69A? Actually known as "Young Physicist". So solution is straightforward.
We need to output exactly "YES" or "NO". We'll use print.
We'll produce a solve() function and then call it if name == "main":.
Let's generate the code.
Now, the conversation: the user says: "Solve the problem." The assistant must output the solution code.
I'll write the code with comments.
Thus final answer: python code. ```python
import sys
def solve() -> None: data = sys.stdin.read().strip().split() if not data: return it = iter(data) n = int(next(it)) sum_x = sum_y = sum_z = 0 for _ in range(n): x = int(next(it)) y = int(next(it)) z = int(next(it)) sum_x += x sum_y += y sum_z += z print("YES" if sum_x == 0 and sum_y == 0 and sum_z == 0 else "NO")