local mmi, mma = math.min, math.max local n, a, b = io.read("*n", "*n", "*n") local x = {} local parent = {} local pend = {} for i = 1, n do x[i] = io.read("*n") parent[i] = i pend[i] = 0 end local left, right = 1, 0 for i = 1, n do while left <= n do if x[left] - x[i] < a then left = left + 1 else break end end while right < n do if x[right + 1] - x[i] <= b then right = right + 1 else break end end -- print(i, left, right) if left <= right then if left ~= parent[left] then local p = parent[left] parent[i] = p for j = pend[p] + 1, right do parent[j] = p end pend[p] = right else local p = parent[i] for j = left, right do parent[j] = p end pend[p] = right end end end -- print(table.concat(parent, " ")) local g = {} for i = 1, n do local p = parent[i] if g[p] then g[p] = g[p] + 1 else g[p] = 1 end end for i = 1, n do print(g[parent[i]]) end