Check whether a set of 3D force vectors adds up to the zero vector.
Young Physicist
You are given force vectors in 3D space. Each vector is described by its , , and components.
Your task is to determine whether the physicist can keep the body in equilibrium, which happens exactly when the sum of all vectors is the zero vector.
In other words, after adding all components together, all components together, and all components together, each total must be $0$.
Print YES if the body is in equilibrium, otherwise print NO.
Input Format
- The first line contains an integer .
- Each of the next lines contains three integers , , and describing one vector.
Output Format
- Print
YESif the sum of all vectors is . - Otherwise print
NO.
Constraints
- Each coordinate is an integer.
- The exact bounds are not required for solving this task; use integer arithmetic.
Example 1
Input
3 4 1 7 -2 4 -1 -2 -5 -6
Output
YES
Explanation
The component-wise sums are , , and .
Example 2
Input
3 3 -1 7 -5 2 -4 2 -1 -2
Output
NO
Explanation
The sums are , , and , so the result is not the zero vector.
Premium problem context
Unlock deeper context for this problem
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.