Mikhail Tikhomirov

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

You are given an integer nn and a number of non-empty sets of elements from 00 to n1n-1.

Construct a permutation pp of length nn, such that for every given set SS the following holds: max_sSp_smin_sSp_s=S1.\max\_{s \in S} p\_s - \min\_{s \in S} p\_s = |S| - 1\text{.}

The solution is guaranteed to exist. If there are multiple solutions output any.

입력

The first line contains two integers nn and mm (3n100,1m1003 \leq n \leq 100, 1 \leq m \leq 100), length of the permutation and the number of sets.

mm lines follow. ii-th of them contains an integer k_ik\_i (2k_i<n2 \leq k\_i < n) followed by k_ik\_i integers a_i,ja\_{i,j} (0a_i,j<n,a_i,j\<a_i,j+10 \leq a\_{i,j} < n, a\_{i,j}\<a\_{i,j+1}), size of the ii-th set and its elements themselves.

It is guaranteed that the given sets are pairwise distinct and the answer exists.

출력

Print nn integers. ii-th of them should be equal to p_ip\_i.