local n, m = io.read("*n", "*n") local line = {} for i = 1, n do line[i] = {} line[i].l = {} line[i].score = -1 end for i = 1, m do local a, b = io.read("*n", "*n") a, b = a + 1, b + 1 table.insert(line[a].l, b) table.insert(line[b].l, a) end local function getmax(curmax) for i = curmax, 1, -1 do if line[i].score == -1 then return i end end return 0 end local curmax = n while 0 < curmax do line[curmax].score = 0 for i = 1, #line[curmax].l do local dstidx = line[curmax].l[i] line[dstidx].score = 1 end curmax = getmax(curmax) end local max1 = 1 for i = n, 1, -1 do if line[i].score == 1 then max1 = i break end end for i = max1, 1, -1 do io.write(line[i].score) end io.write("\n")