class UnionFind
    def initialize
        @obj_to_node = {}
    end

    def add(obj)
        @obj_to_node[obj] ||= Node.new(obj)
    end

    class Node
        def initialize(obj)
            @obj = obj
            @parent = self
            @size = 1
            @rank = 0
        end

        def root
            return self if @parent == self
            @parent = @parent.root
        end

        attr_accessor :parent, :size, :rank, :obj
    end

    def union(x, y)
        u = (@obj_to_node[x] ||= Node.new(x)).root
        v = (@obj_to_node[y] ||= Node.new(y)).root
        return u.obj if u == v
        if u.rank > v.rank
            v.parent = u
            u.size += v.size
            return u.obj
        elsif v.rank > u.rank
            u.parent = v
            v.size += u.size
            return v.obj
        else
            u.parent = v
            v.rank += 1
            v.size += u.size
            return v.obj
        end
    end

    def groups
        @obj_to_node.keys.group_by {|x| @obj_to_node[x].root.obj}
    end
end

n, m = gets.split.map(&:to_i)

machines = (1..m).map { gets.split.map(&:to_i) }.sort_by(&:first).reverse.map(&:last)

h = {}
l = {}
hg = UnionFind.new
lg = UnionFind.new
(1..n).each do |i|
    h[i] = i
    hg.add(i)
    l[i] = i
    lg.add(i)
end

machines.each do |y|
    if h[y] and h[y + 1]
        h[y + 1] = hg.union(h[y], h[y + 1])
    elsif h[y]
        h[y + 1] = h[y]
    end
    h[y] = nil

    if l[y + 1] and l[y]
        l[y] = lg.union(l[y + 1], l[y])
    elsif l[y + 1]
        l[y] = l[y + 1]
    end
    l[y + 1] = nil
end

hl = Hash.new(1)
gh = hg.groups
gl = lg.groups
h.each do |i, r|
    (gh[r] || []).each do |k|
        hl[k] += i
    end
end
l.each do |i, r|
    (gl[r] || []).each do |k|
        hl[k] -= i
    end
end
puts (1..n).map {|i| hl[i]} * ' '

