import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random #sys.setrecursionlimit(10**9) #sys.set_int_max_str_digits(0) input = sys.stdin.readline n,m = map(int,input().split()) check = [[] for i in range(n)] c = [0 for i in range(n)] for i in range(m): p,q = map(int,input().split()) p -= 1 check[p].append(q) r = [0 for i in range(n)] temp = 0 cnt = 0 h = [] for i in range(n): for j in check[i]: temp += j cnt += 1 heapq.heappush(h,i+j) r[i] = temp while h and h[0] == i: cnt -= 1 heapq.heappop(h) temp = max(temp-cnt,0) l = [0 for i in range(n)] temp = 0 cnt = 0 h = [] for i in reversed(range(n)): for j in check[i]: temp += j cnt += 1 heapq.heappush(h,-(i-j)) l[i] = temp while h and h[0] == -i: cnt -= 1 heapq.heappop(h) temp = max(temp-cnt,0) for i in range(n): print(l[i]+r[i]-sum(check[i]),end=' ') #0 1 3 4 5 5 3 2 1 0