You have been given an integer N and N segments [Li,Ri]1≤i≤N. Now, we call a set of distinct integers {k1,k2,...,kx},1≤ki≤N good, if it is possible to arrange the integers in the set in some particular order to form a sequence c1,c2...cx, such that :
The Segment with index ci contains segment with index ci−1,∀2≤i≤x. Segments are indexed by the order in which they appear in the input, beggining with 1.
A segment [Lx,Rx] is said to contain a segment [Ly,Ry], if Lx≤Ly and Rx≥Ry. Now, for each j from 1 to N, you need find the number of good subsets of size j.
Print these numbers in increasing order of j. As these numbers can be rather large, print them Modulo 998244353, a widely used prime.
Input Format :
The first line contains a single integer N. Each of the next N lines contain 2 space separated integers, where the 2 integers on the ith line denote Li,Ri.
Output Format
Print N space separated integers. Note that all the integers need to be printed Modulo 998244353
Constraints :
1≤N≤3000
1≤Li≤Ri≤2⋅109
The good subsets of size 1 are {1},{2},{3}, and the good subsets of size 2 are {1,2},{2,3}
The subset {1,2} is good since we can form the sequence 2,1, since segment with index 1 from the input contains the segment with index 2.
Similarily, the subset {2,3} is good since we can arrange the integers to form the sequence 2,3 since we know the segment with index 3 from the input contains the segment with index 2