#!/bin/ruby n = gets.strip.to_i z = 0 for a0 in (0..n-1) x,y = gets.strip.split(' ') x = x.to_i y = y.to_i z = x + z end if z != 0 puts "NO" else puts "YES" end