N,M,*S = $<.read.split.map &:to_i
A = [[]]*(N+1)
m = 1
M.times {|i|
  s = S[i+i,2]
  a,b = r = s.dup
  x,y = s.map {|i;j| r<< i=j while (j=A[i])[0]; i}
  x,y = y,x  if x > y
  g,h = [A[x],A[y]].map{|h| h.empty? ? {a=>0,b=>0} : h}
  g,h = h,g  if g.size > h.size
  h.merge! g  if h.object_id != g.object_id
  r.each {A[_1] = y}
  A[y] = h
  m < s=h.size and m = s
}
p m