You have been given an integer and segments . Now, we call a set of distinct integers good, if it is possible to arrange the integers in the set in some particular order to form a sequence , such that :
The Segment with index contains segment with index . Segments are indexed by the order in which they appear in the input, beggining with .
A segment is said to contain a segment , if and . Now, for each from to , you need find the number of good subsets of size .
Print these numbers in increasing order of . As these numbers can be rather large, print them Modulo , a widely used prime.
Input Format :
The first line contains a single integer . Each of the next lines contain space separated integers, where the integers on the line denote .
Output Format
Print space separated integers. Note that all the integers need to be printed Modulo
Constraints :
The good subsets of size are , and the good subsets of size are
The subset is good since we can form the sequence , since segment with index from the input contains the segment with index .
Similarily, the subset is good since we can arrange the integers to form the sequence since we know the segment with index from the input contains the segment with index