def init
  x = 1
  while x < $n
    x <<= 1
  end
  $n = x
  $arr = (2 * $n - 1).times.map{ |i| [i - $n + 1, 0] }
end

def update(i, m)
  i += $n - 1
  $arr[i][1] += m
  while i > 0
    i = (i - 1) / 2
    $arr[i] = $arr[i*2+1][1] >= $arr[i*2+2][1] ? $arr[i*2+1] : $arr[i*2+2]
  end
end

$n, q = gets.split.map(&:to_i)
init
q.times do
  i, m = gets.split.map(&:to_i)
  update(i, m)
  puts $arr[0].join(' ')
end