You are given $n$ segments on a coordinate line; each endpoint of every segment has integer coordinates. Some segments can degenerate to points. Segments can intersect with each other, be nested in each other or even coincide.

Your task is the following: for every $k \in [1..n]$, calculate the number of points with integer coordinates such that the number of segments that cover these points equals $k$. A segment with endpoints $l_i$ and $r_i$ covers point $x$ if and only if $l_i \le x \le r_i$.


-----Input-----

The first line of the input contains one integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the number of segments.

The next $n$ lines contain segments. The $i$-th line contains a pair of integers $l_i, r_i$ ($0 \le l_i \le r_i \le 10^{18}$) — the endpoints of the $i$-th segment.


-----Output-----

Print $n$ space separated integers $cnt_1, cnt_2, \dots, cnt_n$, where $cnt_i$ is equal to the number of points such that the number of segments that cover these points equals to $i$.


-----Examples-----
Input
3
0 3
1 3
3 8

Output
6 2 1 

Input
3
1 3
2 4
5 7

Output
5 2 0 



-----Note-----

The picture describing the first example:

[Image]

Points with coordinates $[0, 4, 5, 6, 7, 8]$ are covered by one segment, points $[1, 2]$ are covered by two segments and point $[3]$ is covered by three segments.

The picture describing the second example:

[Image]

Points $[1, 4, 5, 6, 7]$ are covered by one segment, points $[2, 3]$ are covered by two segments and there are no points covered by three segments.

Difficulty: MEDIUM_HARD

Solutions:
n = int(input())
left = []
right = []
for i in range(n):
	data = input().split()
	left.append(int(data[0]))
	right.append(int(data[1]))
left.sort()
right.sort()
i = 0
j = 0
count = 1
ans = [0] * (n + 1)
left += [max(right) + 1]
right += [max(right) + 2]
while i < n and j < n:
	while left[i + 1] <= right[j]:
		ans[count] += left[i + 1] - left[i]
		count += 1
		i += 1
	ans[count] += right[j] - left[i] + 1
	i += 1
	count -= 1
	while (i == n or right[j + 1] < left[i]) and j < n - 1:
		ans[count] += right[j + 1] - right[j]
		count -= 1
		j += 1
	ans[count] += left[i] - right[j] - 1
	j += 1
	count += 1
for i in range(1, n + 1):
	print(ans[i], end=' ')
print()


import sys

class main:

	def __init__(self):
		self.n = int(sys.stdin.readline())
		self.line = dict()
		for i in range(self.n):
			(a, b) = (int(s) for s in sys.stdin.readline().rstrip().split(' '))
			self.line[a] = self.line.get(a, 0) + 1
			self.line[b + 1] = self.line.get(b + 1, 0) - 1

	def calc(self):
		self.result = dict()
		sorted_keys = sorted(self.line.keys())
		count = 0
		last = sorted_keys[0]
		for k in sorted_keys:
			self.result[count] = self.result.get(count, 0) + k - last
			count = count + self.line[k]
			last = k
		del self.result[0]

	def out(self):
		for k in range(1, self.n):
			print(self.result.get(k, 0), end=' ')
		print(self.result.get(self.n, 0), end='')

	def solve(self):
		self.calc()
		self.out()
m = main()
m.solve()
pass


N = int(input())
points = []
for i in range(N):
	(a, b) = map(int, input().split())
	points.append((a, 1))
	points.append((b + 1, -1))
points = sorted(points, key=lambda x: x[0])
count = [0 for i in range(N + 1)]
overlapp = 0
prev = 0
for point in points:
	count[overlapp] += point[0] - prev
	overlapp += point[1]
	prev = point[0]
print(' '.join(map(str, count[1:])))


import os
from io import BytesIO, IOBase
import sys

def main():
	n = int(input())
	a = []
	for i in range(n):
		(x, y) = map(int, input().split())
		a.append((x, 0))
		a.append((y, 1))
	a.sort()
	(ans, s) = ([0] * n, [])
	for (x, y) in a:
		if y:
			ans[len(s) - 1] += x - s[-1][0] + 1 - s[-1][1]
			z = s.pop()
			if s != []:
				s[-1][1] += x - z[0] + 1
		else:
			s.append([x, 0])
	print(*ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
pos = {}
for _ in range(n):
	(l, r) = [int(x) for x in input().split()]
	if l in pos:
		pos[l] += 1
	else:
		pos[l] = 1
	if r + 1 in pos:
		pos[r + 1] -= 1
	else:
		pos[r + 1] = -1
a = sorted(pos.items(), key=lambda x: x[0])
res = [0] * n
s = 0
for i in range(len(a)):
	if 1 <= s <= n:
		res[s - 1] += a[i][0] - a[i - 1][0]
	s += a[i][1]
print(*res)


def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
from collections import Counter
n = ii()
a1 = [tuple(mi()) for i in range(n)]
a = []
for (l, r) in a1:
	a.append((l, 0))
	a.append((r, 1))
c = Counter(a)
b = [(k[0], k[1], v) for (k, v) in c.items()]
b.sort()
ans = [0] * (n + 1)
p = -1
cnt = 0
for (x, y, z) in b:
	if y == 0:
		ans[cnt] += x - p - 1
		cnt += z
		ans[cnt] += 1
	else:
		if x != p:
			ans[cnt] += x - p
		cnt -= z
	p = x
print(*ans[1:])


from collections import *
d = defaultdict(int)
n = int(input())
for _ in range(n):
	(l, r) = map(int, input().split())
	d[l] += 1
	d[r + 1] -= 1
recent = 0
cnt = 0
ans = [0] * (n + 1)
for k in sorted(d):
	ans[cnt] += k - recent
	recent = k
	cnt += d[k]
print(*ans[1:])


n = int(input())
dictionary = {}
default = 10 ** 9 + 7
for i in range(n):
	(l, r) = [int(x) for x in input().split(' ')]
	if dictionary.get(l, default) == default:
		dictionary[l] = 0
	if dictionary.get(r + 1, default) == default:
		dictionary[r + 1] = 0
	dictionary[l] += 1
	dictionary[r + 1] -= 1
arr = [0] * (n + 10)
count = 0
indicies = sorted(dictionary.keys())
for i in range(len(indicies) - 1):
	count += dictionary[indicies[i]]
	diff = indicies[i + 1] - indicies[i]
	arr[count] += diff
result = ''
for i in range(1, n + 1):
	result += str(arr[i]) + ' '
print(result)


import os
import io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
n = int(input())
ev = []
for _ in range(n):
	(l, r) = map(int, input().split())
	ev += [(l, +1), (r + 1, -1)]
counts = [0] * (n + 1)
ev.sort()
prev = -1
count = 0
for (pos, diff) in ev:
	if pos == prev:
		counts[count] -= 1
	if pos - prev - 1 > 0:
		counts[count] += pos - prev - 1
	count += diff
	counts[count] += 1
	prev = pos
print(*counts[1:])


from collections import *
n = int(input())
d = defaultdict(int)
for _ in [0] * n:
	(l, r) = map(int, input().split())
	d[l] += 1
	d[r + 1] -= 1
s = p = 0
f = [0] * (n + 1)
for k in sorted(d):
	f[s] += k - p
	s += d[k]
	p = k
print(*f[1:])
j = 9


from collections import Counter
n = int(input())
left = Counter()
right = Counter()
events = set()
for i in range(n):
	(l, r) = map(int, input().split(' '))
	left[l] += 1
	right[r + 1] += 1
	events.add(l)
	events.add(r + 1)
events = sorted(list(events))
count = 0
covered = [0] * n
last = events[0]
for event in events:
	length = event - last
	if count > 0:
		covered[count - 1] += length
	if left[event]:
		count += left[event]
	if right[event]:
		count -= right[event]
	last = event
print(*covered)


BEGIN = 'begin'
END = 'end'

def main():
	n = int(input())
	points = dict()
	for _ in range(n):
		(li, ri) = list(map(int, input().split()))
		update_point_status(points, li, BEGIN)
		update_point_status(points, ri, END)
	points = sorted(list(points.items()), key=lambda x: x[0])
	answer = [0] * (n + 1)
	start = -1
	count = 0
	for point in points:
		points_amount = point[0] - start - 1
		answer[count] += points_amount
		count += point[1][BEGIN]
		answer[count] += 1
		count -= point[1][END]
		start = point[0]
	print(' '.join(list(map(str, answer[1:]))))

def update_point_status(lines, point, status):
	if point not in lines:
		lines[point] = {BEGIN: 0, END: 0}
	lines[point][status] += 1
main()


n = int(input())
pos = {}
for _ in range(n):
	(L, R) = map(int, input().split())
	if L in pos:
		pos[L] += 1
	else:
		pos[L] = 1
	if R + 1 in pos:
		pos[R + 1] -= 1
	else:
		pos[R + 1] = -1
a = sorted(pos.items(), key=lambda x: x[0])
res = [0] * n
s = 0
for i in range(len(a)):
	if 1 <= s <= n:
		res[s - 1] += a[i][0] - a[i - 1][0]
	s += a[i][1]
print(*res)


from sys import stdin
from collections import defaultdict
(n, d) = (int(input()), defaultdict(int))
for s in stdin.read().splitlines():
	(u, v) = map(int, s.split())
	d[u] += 1
	d[v + 1] -= 1
cnt = [0] * (n + 1)
xx = sorted(d.keys())
(u, c) = (xx[0], 0)
for v in xx:
	cnt[c] += v - u
	u = v
	c += d[v]
print(' '.join(map(str, cnt[1:])))


import sys
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def main():
	n = int(input())
	X = set()
	X.add(0)
	X.add(10 ** 18)
	LR = []
	for i in range(n):
		(l, r) = map(int, input().split())
		X.add(l)
		X.add(l + 1)
		X.add(r)
		X.add(r + 1)
		LR.append((l, r))
	X = list(X)
	X.sort()
	toid = {}
	for (i, x) in enumerate(X):
		toid[x] = i
	N = len(toid)
	imos = [0] * (N + 1)
	for (l, r) in LR:
		(l, r) = (toid[l], toid[r])
		imos[l] += 1
		imos[r + 1] -= 1
	from itertools import accumulate
	imos = list(accumulate(imos))
	ans = [0] * (n + 1)
	for i in range(N):
		k = imos[i]
		if k >= 1:
			ans[k] += X[i + 1] - X[i]
	print(*ans[1:])
main()


from copy import deepcopy
import itertools
from bisect import bisect_left
from bisect import bisect_right
import math
from collections import deque

def read():
	return int(input())

def readmap():
	return map(int, input().split())

def readlist():
	return list(map(int, input().split()))
N = read()
LIST = []
left = 0
right = 1
for i in range(N):
	(l, r) = readmap()
	LIST.append((l, left))
	LIST.append((r, right))
LIST.sort()
cnt = [0] * (N + 1)
n = 1
x = LIST[0][0]
dir = left
for item in LIST[1:]:
	if item[1] == left:
		if dir == left:
			cnt[n] += item[0] - x
			n += 1
			x = item[0]
			dir = left
		else:
			cnt[n] += item[0] - x - 1
			n += 1
			x = item[0]
			dir = left
	elif dir == left:
		cnt[n] += item[0] - x + 1
		n -= 1
		x = item[0]
		dir = right
	else:
		cnt[n] += item[0] - x
		n -= 1
		x = item[0]
		dir = right
print(' '.join(list(map(str, cnt[1:]))))


import sys
from array import array
from collections import Counter

def readline():
	return sys.stdin.buffer.readline().decode('utf-8')
n = int(readline())
add_cnt = Counter()
sub_cnt = Counter()
keys = set()
for (l, r) in (map(int, readline().split()) for _ in range(n)):
	add_cnt[l] += 1
	sub_cnt[r] += 1
	keys.add(l)
	keys.add(r)
keys = sorted(keys)
nest = add_cnt[keys[0]] - sub_cnt[keys[0]]
ans = [0] * (n + 1)
ans[add_cnt[keys[0]]] = 1
for (x, y) in zip(keys, keys[1:]):
	ans[nest] += y - x - 1
	nest += add_cnt[y]
	ans[nest] += 1
	nest -= sub_cnt[y]
print(*ans[1:])


def solve(N, A):
	cnt = [0] * (N + 1)
	evd = {}
	xs = []
	for (a, b) in A:
		if a not in evd:
			evd[a] = [0, 0]
			xs.append(a)
		if b not in evd:
			evd[b] = [0, 0]
			xs.append(b)
		evd[a][0] += 1
		evd[b][1] += 1
	xs.sort()
	px = xs[0] - 1
	pop = 0
	for x in xs:
		cnt[pop] += x - px - 1
		cnt[pop + evd[x][0]] += 1
		pop -= evd[x][1]
		pop += evd[x][0]
		px = x
	return cnt[1:]

def main():
	N = int(input())
	A = [tuple([int(e) for e in input().split(' ')]) for _ in range(N)]
	print(*solve(N, A))
main()


import sys
input = sys.stdin.readline
n = int(input())
l = []
for _ in range(n):
	(li, ri) = map(int, input().split())
	l.append((1, li))
	l.append((-1, ri + 1))
l.sort(key=lambda k: k[1])
ans = [0] * (n + 1)
cnt = 0
for i in range(len(l) - 1):
	cnt += l[i][0]
	ans[cnt] += l[i + 1][1] - l[i][1]
for i in range(1, n + 1):
	if i < n:
		print(ans[i], end=' ')
	else:
		print(ans[i])


n = int(input())
ls = []
rs = []
evs = []
for i in range(n):
	(l, r) = map(int, input().split(' '))
	ls += [l]
	rs += [r]
ls.sort()
rs.sort()
li = 0
ri = 0
while li < len(ls) or ri < len(rs):
	takeFromLeft = ri == len(rs) or (li < len(ls) and ls[li] <= rs[ri])
	if takeFromLeft:
		l = ls[li]
		evs += [(l, -1), (l, 0)]
		if li + 1 == len(ls) or ls[li + 1] != l:
			evs += [(l, 1)]
		li += 1
	else:
		r = rs[ri]
		evs += [(r, -1), (r, 1), (r, 2)]
		ri += 1
res = [0] * (n + 1)
count = 0
lastX = None
mesXpr = None
mesXcur = None
for (x, t) in evs:
	if t == -1:
		if mesXpr == x:
			continue
		if mesXpr != None:
			c = x - mesXpr - 1
			res[count] += c
		mesXpr = x
	elif t == 0:
		count += 1
	elif t == 1:
		if mesXcur == x:
			continue
		res[count] += 1
		mesXcur = x
	else:
		count -= 1
print(*res[1:])


from collections import *
x = int(input())
d = defaultdict(int)
for _ in [0] * x:
	(l, r) = map(int, input().split())
	d[l] += 1
	d[r + 1] -= 1
s = p = 0
f = [0] * (x + 1)
for k in sorted(d):
	f[s] += k - p
	s += d[k]
	p = k
print(*f[1:])


n = int(input())
b = {}
for i in range(n):
	(l, r) = list(map(int, input().split()))
	if l not in b.keys():
		b[l] = 1
	else:
		b[l] += 1
	if r + 1 not in b.keys():
		b[r + 1] = -1
	else:
		b[r + 1] -= 1
c = []
for i in sorted(b):
	c.append([i, b[i]])
d = 0
e = [0] * (n + 1)
for i in range(len(c) - 1):
	d = d + c[i][1]
	e[d] += c[i + 1][0] - c[i][0]
print(*e[1:])


import math
import heapq, bisect
import sys
from collections import deque
from fractions import Fraction
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] > k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
n = int(input())
d = dict()
for i in range(n):
	(a, b) = map(int, input().split())
	if a in d:
		d[a] += 1
	else:
		d.update({a: 1})
	if b + 1 in d:
		d[b + 1] -= 1
	else:
		d.update({b + 1: -1})
c = 0
e = dict()
t = 0
l = list(d.keys())
l.append(10 ** 18 + 1)
l.sort()
for i in sorted(d):
	c += d[i]
	if c in e:
		e[c] += l[t + 1] - i
	else:
		e.update({c: l[t + 1] - i})
	t += 1
if 0 in e:
	del e[0]
for i in range(1, n + 1):
	if i not in e:
		e.update({i: 0})
for i in sorted(e):
	print(e[i], end=' ')


n = int(input())
from collections import defaultdict, Counter
a = defaultdict(list)
count_left = Counter()
count_right = Counter()
for _ in range(n):
	(l, r) = map(int, input().split())
	count_left[l] += 1
	count_right[r] += 1
count = [0] * (n + 1)
pts = sorted(set(count_left.keys()) | set(count_right.keys()))
c = 0
prev = pts[0]
for pt in pts:
	if count_left[pt]:
		count[c] += pt - prev - 1
		c += count_left[pt]
		count[c] += 1
		c -= count_right[pt]
	else:
		count[c] += pt - prev
		c -= count_right[pt]
	prev = pt
print(' '.join(map(str, count[1:])))


point = {}
n = int(input())
for i in range(n):
	(l, r) = map(int, input().split())
	r += 1
	if l not in point:
		point[l] = 0
	if r not in point:
		point[r] = 0
	point[l] += 1
	point[r] -= 1
line = []
for key in point:
	line.append((key, point[key]))
line.sort()
ans = [0] * (n + 1)
last_index = 0
last_value = 0
for (index, value) in line:
	ans[last_value] += index - last_index
	last_index = index
	last_value += value
for cnt in ans[1:]:
	print(cnt, end=' ')


import sys, os, io
from sys import stdin
from math import log, gcd, ceil
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import math

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def solve():
	n = ii()
	d = defaultdict(lambda : 0)
	d1 = defaultdict(lambda : 0)
	for i in range(n):
		(x, y) = li()
		d[x - 1] -= 1
		d[y] += 1
	x = list(d.keys())
	x.sort()
	r = x[-1]
	c = d[r]
	temp = 1
	for i in range(len(x) - 2, -1, -1):
		l = x[i] + 1
		d1[c] += r - l + temp
		c += d[x[i]]
		r = l
		temp = 0
	for i in range(1, n + 1):
		print(d1[i], end=' ')
	print()
t = 1
for _ in range(t):
	solve()


import collections

def main():
	n = int(input())
	mp = dict()
	for i in range(n):
		(s, e) = [int(x) for x in input().split()]
		if s in mp:
			mp[s] += 1
		else:
			mp[s] = 1
		e = e + 1
		if e in mp:
			mp[e] -= 1
		else:
			mp[e] = -1
	mp = collections.OrderedDict(sorted(mp.items()))
	ans = [0] * (n + 1)
	cnt = 0
	prev = 0
	for (k, v) in mp.items():
		if cnt == 0:
			prev = k
			cnt = v
		else:
			ans[cnt] += k - prev
			prev = k
			cnt += v
	print(*ans[1:])
main()


n = int(input())
a = []
for i in range(n):
	(l, r) = list(map(int, input().split()))
	a.append([l, 1])
	a.append([r + 1, -1])
a.sort()
c = 0
ans = [0] * (n + 1)
for i in range(2 * n):
	c += a[i][1]
	if i + 1 < len(a) and a[i][0] != a[i + 1][0]:
		ans[c] += a[i + 1][0] - a[i][0]
print(*ans[1:])


n = int(input())
points = set()
starts = {}
ends = {}
for i in range(n):
	(a, b) = map(int, input().split())
	points.add(a)
	points.add(b)
	starts[a] = 1 + starts.get(a, 0)
	ends[b] = 1 + ends.get(b, 0)
spoints = sorted(points)
dwd = {}
prev_point = spoints[0]
density = 0
for (i, cur_point) in enumerate(spoints):
	interval_length = cur_point - prev_point - 1
	if interval_length > 0:
		dwd[density] = interval_length + dwd.get(density, 0)
	starts_here = starts.get(cur_point, 0)
	density += starts_here
	dwd[density] = 1 + dwd.get(density, 0)
	ends_here = ends.get(cur_point, 0)
	density -= ends_here
	prev_point = cur_point
for i in range(1, n + 1):
	print(dwd.get(i, 0), end=' ')


import bisect
n = int(input())
lis = list()
idx = dict()
for i in range(n):
	(l, r) = map(int, input().split())
	idx[l] = 1
	idx[r + 1] = 1
	lis.append([l, r])
val = [key for (key, val) in idx.items()]
val.sort()
cnt = [0] * (2 * n + 1)
for item in lis:
	f1 = bisect.bisect_left(val, item[0])
	f2 = bisect.bisect_left(val, item[1] + 1)
	cnt[f1] += 1
	cnt[f2] -= 1
for i in range(1, 2 * n):
	cnt[i] += cnt[i - 1]
ans = [0] * (n + 1)
for i in range(1, len(val)):
	sm = val[i] - val[i - 1]
	ans[cnt[i - 1]] += sm
for i in range(1, n + 1):
	print(ans[i], end=' ')


from collections import defaultdict
ans = defaultdict(int)
n = int(input())
(beg, end) = ([0] * n, [0] * n)
for i in range(n):
	(a, b) = map(int, input().split())
	beg[i] = a
	end[i] = b + 1
beg.sort()
end.sort()
(pa, pb) = (0, 0)
cur = 0
lst = -1
while pb < n:
	pos = end[pb]
	if pa < n:
		pos = min(pos, beg[pa])
	ans[cur] += pos - lst
	ad = 0
	mn = 0
	while pa < n and beg[pa] == pos:
		ad += 1
		pa += 1
	while pb < n and end[pb] == pos:
		pb += 1
		mn -= 1
	lst = pos
	cur += ad + mn
for i in range(1, n + 1):
	print(ans[i], end=' ')


from collections import defaultdict
(n, s) = (int(input()), [])
for i in range(n):
	a = [int(x) for x in input().split()]
	s += [(a[0], 0), (a[1], 1)]
s.sort()
(now, rev) = (0, defaultdict(int))
for (a, b) in zip(s, s[1:]):
	now += 1 if a[1] == 0 else -1
	if a[1] == 0:
		rev[now] += b[0] - a[0] + (1 if b[1] == 1 else 0)
	elif b[0] != a[0]:
		rev[now] += b[0] - a[0] - (1 if b[1] == 0 else 0)
[print(rev[i], end=' ') for i in range(1, n + 1)]


n = int(input())
l = [0 for i in range(n + 1)]
lo = []
lc = []
for i in range(n):
	(x, y) = map(int, input().strip().split())
	lo.append(x)
	lc.append(y)
lo.sort()
lc.sort()
i = 1
j = 0
count = 1
st = lo[0]
ref = 0
while i < n and j < n:
	if lo[i] <= lc[j]:
		if ref == 0:
			l[count] = l[count] + lo[i] - st
		else:
			l[count] = l[count] + lo[i] - st - 1
		ref = 0
		count = count + 1
		st = lo[i]
		i = i + 1
	else:
		if ref == 0:
			l[count] = l[count] + lc[j] - st + 1
		else:
			l[count] = l[count] + lc[j] - st
		count = count - 1
		ref = 1
		st = lc[j]
		j = j + 1
while j < n:
	if ref == 0:
		l[count] = l[count] + lc[j] - st + 1
	else:
		l[count] = l[count] + lc[j] - st
	count = count - 1
	ref = 1
	st = lc[j]
	j = j + 1
print(' '.join(map(str, l[1:])))


import sys
n = int(sys.stdin.readline())
start = dict()
end = dict()
for i in range(n):
	(b, c) = (int(s) for s in sys.stdin.readline().rstrip().split(' '))
	start[b] = start.setdefault(b, 0) + 1
	start.setdefault(c, 0)
	end[c] = end.setdefault(c, 0) + 1
	end.setdefault(b, 0)
keys = sorted(start.keys())
k = 0
a = [0 for x in range(n + 1)]
prev = -1
start_c = 0
end_c = 0
for key in keys:
	if prev != -1 and key - prev > 1:
		a[start_c - end_c] += key - prev - 1
	start_c += start[key]
	a[start_c - end_c] += 1
	end_c += end[key]
	prev = key
print(' '.join((str(x) for x in a[1:n + 1])))


import sys
input = sys.stdin.buffer.readline
from collections import defaultdict as dd
n = int(input())
d = dd(int)
for i in range(n):
	(l, r) = map(int, input().split())
	d[l] += 1
	d[r + 1] -= 1
arr = list(d.keys())
arr.sort()
ans = [0 for i in range(n + 1)]
count = 0
l = len(arr)
arr.append(arr[-1])
for i in range(l):
	count += d[arr[i]]
	ans[count] += arr[i + 1] - arr[i]
print(*ans[1:])


from sys import stdin, stdout
get_string = lambda : stdin.readline().strip('\n')
get_intmap = lambda : map(int, get_string().split(' '))

def testcase():
	n = int(input())
	cnt = dict()
	for i in range(n):
		(l, r) = get_intmap()
		cnt[l] = cnt.get(l, 0) + 1
		cnt[r + 1] = cnt.get(r + 1, 0) - 1
	ans = [0] * (n + 1)
	sk = sorted(cnt.keys())
	cnt_i = 0
	for (ind, i) in enumerate(sk[:-1]):
		cnt_i += cnt[i]
		ans[cnt_i] += sk[ind + 1] - i
	print(' '.join([str(i) for i in ans[1:]]))
testcase()
quit()
for t in range(int(input())):
	testcase()


import configparser
import sys
input = sys.stdin.readline

def main():
	n = int(input())
	points = []
	for i in range(n):
		(l, r) = [int(x) for x in input().split(' ')]
		points.append((l, 'o', i))
		points.append((r, 'c', i))
	points = sorted(points, key=lambda x: x[0])
	ans = [0 for i in range(n + 1)]
	cnt = 0
	i = 0
	while i < len(points):
		j = i
		cl = 0
		while j < len(points) and points[j][0] == points[i][0]:
			if points[j][1] == 'c':
				cl += 1
			cnt += 1 if points[j][1] == 'o' else -1
			j += 1
		ans[cnt + cl] += 1
		if j >= len(points):
			break
		dist = points[j][0] - points[j - 1][0] - 1
		ans[cnt] += dist
		i = j
	for i in ans[1:]:
		print(i, end=' ')
main()


from collections import defaultdict
n = int(input())
arr = defaultdict(int)
for a0 in range(n):
	(l, r) = input().strip().split()
	(l, r) = (int(l), int(r))
	arr[l] += 1
	arr[r + 1] -= 1
brr = [0] * (n + 1)
l = sorted(arr.keys())
sum = arr[l[0]]
prevpoint = l[0]
for key in l[1:]:
	brr[sum] += key - prevpoint
	prevpoint = key
	sum += arr[key]
print(*brr[1:])


n = int(input())
a = []
for i in range(n):
	(l, r) = map(int, input().split())
	a.append([l, 1])
	a.append([r + 1, -1])
a.sort()
ans = [0] * (n + 1)
idx = 0
for i in range(len(a) - 1):
	idx += a[i][1]
	ans[idx] += a[i + 1][0] - a[i][0]
for i in range(1, n + 1):
	print(ans[i], end=' ')
print()


from sys import stdin, stdout
n = int(stdin.readline())
mp = dict()
for i in range(n):
	(l, r) = map(int, stdin.readline().split(' '))
	if l in mp:
		mp[l] += 1
	else:
		mp[l] = 1
	if r + 1 in mp:
		mp[r + 1] += -1
	else:
		mp[r + 1] = -1
ans = (n + 1) * [0]
l = sorted(mp.keys())
cnt = mp[l[0]]
for i in range(1, len(l)):
	ans[cnt] += l[i] - l[i - 1]
	cnt += mp[l[i]]
a = ' '.join(map(str, ans[1:]))
stdout.write(a)


n = int(input())
x = [0 for _ in range(n)]
y = [0 for _ in range(n)]
for i in range(n):
	str = input().split(' ')
	x[i] = int(str[0])
	y[i] = int(str[1])
x.sort()
y.sort()
(x_ind, y_ind, size) = (0, 0, 1)
curr_point = x[0]
counter = [0 for _ in range(n + 1)]
is_x = True
for _ in range(2 * n - 1):
	if is_x:
		if x_ind < n - 1 and x[x_ind + 1] <= y[y_ind]:
			counter[size] += x[x_ind + 1] - curr_point
			size += 1
			x_ind += 1
			curr_point = x[x_ind]
		else:
			counter[size] += y[y_ind] - curr_point + 1
			size -= 1
			curr_point = y[y_ind]
			is_x = False
	elif x_ind < n - 1 and x[x_ind + 1] <= y[y_ind + 1]:
		counter[size] += x[x_ind + 1] - curr_point - 1
		size += 1
		x_ind += 1
		y_ind += 1
		curr_point = x[x_ind]
		is_x = True
	else:
		counter[size] += y[y_ind + 1] - curr_point
		size -= 1
		y_ind += 1
		curr_point = y[y_ind]
for i in range(1, n + 1):
	print(counter[i], end=' ')


from collections import defaultdict
n = int(input())
pos_map = defaultdict(lambda : 0)
points = defaultdict(lambda : 0)
for _ in range(n):
	(l, r) = map(int, input().split(' '))
	pos_map[l] += 1
	pos_map[r + 1] -= 1
poses = sorted(pos_map)
cur_num = pos_map[poses[0]]
cur_pos = poses[0]
for pos in poses[1:]:
	points[cur_num] += pos - cur_pos
	cur_num += pos_map[pos]
	cur_pos = pos
res = [points[i] for i in range(1, n + 1)]
print(' '.join(map(str, res)))


n = int(input())
l = []
for i in range(n):
	(a, b) = map(int, input().split())
	l.append((a, 1))
	l.append((b + 1, 0))
l.sort()
ans = [0 for i in range(n + 1)]
val = 0
for i in range(2 * n - 1):
	if l[i][1] == 1:
		val += 1
	else:
		val -= 1
	ans[val] += l[i + 1][0] - l[i][0]
for i in ans[1:]:
	print(i, ' ', sep='', end='')


from collections import *
n = int(input())
d = defaultdict(int)
for _ in [0] * n:
	(l, r) = list(map(int, input().split()))
	d[l] += 1
	d[r + 1] -= 1
s = p = 0
f = [0] * (n + 1)
for (k, v) in sorted(d.items()):
	f[s] += k - p
	s += v
	p = k
print(*f[1:])