The countries of Byteland have decided to unite and form the Union of Byte Countries. One of its first policies is a system of direct agricultural subsidies: every farmer is given a natural number describing the size of the farm they own, and this number determines the subsidy they receive.
To reduce inequality, the parliament decided to pay the most to farmers holding the smallest numbers, counting from 0. Because each farmer would then simply claim the value 0, one rule was added: each farmer must be assigned the smallest natural number that differs from every number assigned to the farmers they employ.
It turns out that for some configurations such an assignment cannot be produced uniquely, or cannot be produced at all. For those situations an extra value, infinity, is used. A farmer X may be assigned infinity when X employs some farmer Y who is also assigned infinity, and none of Y's own employees was assigned the finite number that X would otherwise want to take. The government wants the final assignment to contain as many infinities as possible, and the assignment satisfying this is unique.
Write a program that computes this assignment. For a farmer whose value is infinity, output −1.
The first line contains an integer t (1≤t≤100) — the number of test cases. The test cases follow.
Each test case begins with a line containing two integers n and m (1≤n≤100, 0≤m<10000) — the number of farmers and the number of employment relations between them. The farmers are numbered from 1 to n.
Each of the next m lines contains two integers a and b (1≤a,b≤n), meaning that farmer a employs farmer b.
For each test case output n lines. The i-th of these lines must contain the value assigned to farmer i. If that value is infinity, output −1 instead.