N,M=gets.split.map(&:to_i)
f=Array.new(N){|i|[i+1]}
M.times{
    a,b=gets.split.map(&:to_i)
    ai=f.index{|i|i.bsearch{|x|a-x}}
    bi=f.index{|i|i.bsearch{|x|b-x}}
    next if ai==bi
    if ai>bi
        t=ai
        ai=bi
        bi=t
    end
    t=f.delete_at(bi)
    f[ai]+=t
    f[ai].sort!
}
#warn f.inspect
puts f.max_by{|i|i.size}.size
