Distinct Values

구간마다 서로 다른 값만 들어 있어야 한다는 조건이 여러 개 주어질 때, 이를 만족하는 양의 정수 배열 중 사전순으로 가장 작은 배열을 만든다.

보통7그리디구간구현아직 제출이 없습니다시간 제한2초메모리 제한256 MB

문제

Chiaki has an array of nn positive integers. You are told some facts about the array: for every two elements a_ia\_i and a_ja\_j in the subarray a_l..ra\_{l..r} (li<jrl \le i < j \le r), a_ia_ja\_i \ne a\_j holds.

Chiaki would like to find a lexicographically minimal array which meets the facts.

입력

There are multiple test cases. The first line of input contains an integer TT, indicating the number of test cases. For each test case:

The first line contains two integers nn and mm (1n,m1051 \le n, m \le 10^5) -- the length of the array and the number of facts. Each of the next mm lines contains two integers l_il\_i and r_ir\_i (1l_ir_in1 \le l\_i \le r\_i \le n).

It is guaranteed that neither the sum of all nn nor the sum of all mm exceeds 10610^6.

출력

For each test case, output nn integers denoting the lexicographically minimal array. Integers should be separated by a single space, and no extra spaces are allowed  at the end of lines.