
class Node
    attr_accessor :val
    def initialize(v, p)
        @val = v
        @parent = p
    end
    def root
        @parent == nil ? self : @parent.root
    end
end


n,m= gets.split(" ").map(&:to_i)
f = Hash.new{|h,k| h[k]=[]}
(1..m).each do
    a,b = gets.chomp.split(" ").map(&:to_i)
    f[a] << b unless f[a].include?(b)
    #f[b] << a unless f[b].include?(a)
end

class Friends
    def initialize(f,n)
        @table=f
        @checked = Array.new(n, nil)
        @group = Hash.new{|h,k| h[k]=[]}
        @table.each do |k,v|
            self.add(k)
        end
    end

    def add(key, id=key)
        return false if @checked[key] != nil

        id = id || key
        @checked[key] = id
        @group[id] << key
        @table[key].each do |f|
            self.add(f,id)
        end
        return true        
    end

    def show
        @group.each do |key, ids|
            puts "["+key.to_s+"]"
            puts ids.join(",")
        end
    end 

    def max
        cnt=0
        @group.each do |k,v|
            l = v.length
            cnt = l if l > cnt 
        end
        return cnt
    end
end

fr= Friends.new(f,n)
puts fr.max

