You are given _n_ sequences. Each sequence consists of positive integers, not exceeding _m_. All integers in one sequence are distinct, but the same integer may appear in multiple sequences. The length of the _i_\-th sequence is _k__i_.
Each second integers in each of the sequences are shifted by one to the left, i.e. integers at positions _i_ > 1 go to positions _i_ - 1, while the first integers becomes the last.
Each second we take the first integer of each sequence and write it down to a new array. Then, for each value _x_ from 1 to _m_ we compute the longest **segment** of the array consisting of element _x_ only.
The above operation is performed for 10100 seconds. For each integer from 1 to _m_ find out the longest segment found at this time.
## Input
The first line of the input contains two integers _n_ and _m_ (1 ≤ _n_, _m_ ≤ 100 000) — the number of sequences and the maximum integer that can appear in the sequences.
Then follow _n_ lines providing the sequences. Each of them starts with an integer _k__i_ (1 ≤ _k__i_ ≤ 40) — the number of integers in the sequence, proceeded by _k__i_ positive integers — elements of the sequence. It's guaranteed that all integers in each sequence are pairwise distinct and do not exceed _m_.
**The total length** of all sequences doesn't exceed 200 000.
## Output
Print _m_ integers, the _i_\-th of them should be equal to the length of the longest segment of the array with all its values equal to _i_ during the first 10100 seconds.
[samples]
[{"iden":"statement","content":"你被给定 #cf_span[n] 个序列。每个序列由不超过 #cf_span[m] 的正整数组成。同一个序列中的所有整数互不相同,但相同的整数可能出现在多个序列中。第 #cf_span[i]-个序列的长度为 #cf_span[ki]。\n\n每秒,每个序列中的整数向左移动一位,即位置 #cf_span[i > 1] 的整数移动到位置 #cf_span[i - 1],而第一个整数变为最后一个。\n\n每秒,我们取出每个序列的第一个整数,并将它们写入一个新的数组。然后,对于从 #cf_span[1] 到 #cf_span[m] 的每个值 #cf_span[x],我们计算该数组中由仅包含 #cf_span[x] 的元素组成的最长 *段*。\n\n上述操作持续进行 #cf_span[10100] 秒。对于从 #cf_span[1] 到 #cf_span[m] 的每个整数,求出在这段时间内出现的最长段的长度。\n\n输入的第一行包含两个整数 #cf_span[n] 和 #cf_span[m] (#cf_span[1 ≤ n, m ≤ 100 000]) —— 序列的数量和序列中可能出现的最大整数。\n\n接下来是 #cf_span[n] 行,每行描述一个序列。每行以一个整数 #cf_span[ki] (#cf_span[1 ≤ ki ≤ 40]) 开头,表示该序列中整数的个数,随后是 #cf_span[ki] 个正整数 —— 序列的元素。保证每个序列中的所有整数两两不同,且不超过 #cf_span[m]。\n\n*所有序列的总长度* 不超过 #cf_span[200 000]。\n\n请输出 #cf_span[m] 个整数,第 #cf_span[i] 个整数应等于在前 #cf_span[10100] 秒内,由值 #cf_span[i] 组成的最长段的长度。"},{"iden":"input","content":"输入的第一行包含两个整数 #cf_span[n] 和 #cf_span[m] (#cf_span[1 ≤ n, m ≤ 100 000]) —— 序列的数量和序列中可能出现的最大整数。接下来是 #cf_span[n] 行,每行描述一个序列。每行以一个整数 #cf_span[ki] (#cf_span[1 ≤ ki ≤ 40]) 开头,表示该序列中整数的个数,随后是 #cf_span[ki] 个正整数 —— 序列的元素。保证每个序列中的所有整数两两不同,且不超过 #cf_span[m]。*所有序列的总长度* 不超过 #cf_span[200 000]。"},{"iden":"output","content":"请输出 #cf_span[m] 个整数,第 #cf_span[i] 个整数应等于在前 #cf_span[10100] 秒内,由值 #cf_span[i] 组成的最长段的长度。"},{"iden":"examples","content":"输入\n3 4\n3 3 4 1\n4 1 3 4 2\n3 3 1 4\n输出\n2\n1\n3\n2\n\n输入\n5 5\n2 3 1\n4 5 1 3 2\n4 2 1 3 5\n1 3\n2 5 3\n输出\n3\n1\n4\n0\n1\n\n输入\n4 6\n3 4 5 3\n2 6 3\n2 3 6\n3 3 6 5\n输出\n0\n0\n2\n1\n1\n2"}}]
**Definitions**
Let $ n, m \in \mathbb{Z}^+ $ with $ 1 \leq n, m \leq 100{,}000 $.
Let $ S_1, S_2, \dots, S_n $ be $ n $ sequences, where each $ S_i = (s_{i,1}, s_{i,2}, \dots, s_{i,k_i}) $ is a sequence of distinct positive integers with $ 1 \leq k_i \leq 40 $ and $ s_{i,j} \leq m $.
Let $ T = 10^{100} $.
For each second $ t \in \{0, 1, \dots, T-1\} $, define the array $ A_t $ as:
$$ A_t = (s_{1, (t \bmod k_1) + 1}, s_{2, (t \bmod k_2) + 1}, \dots, s_{n, (t \bmod k_n) + 1}) $$
For each value $ x \in \{1, 2, \dots, m\} $, define $ L_x $ as the maximum length of a contiguous segment (subarray) in any $ A_t $ (for $ t \in \{0, 1, \dots, T-1\} $) where all elements equal $ x $.
**Constraints**
1. $ \sum_{i=1}^n k_i \leq 200{,}000 $
2. All elements in each $ S_i $ are distinct and in $ [1, m] $.
**Objective**
For each $ x \in \{1, 2, \dots, m\} $, compute $ L_x $.