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

friends = Hash.new{|hash,key| hash[key] = [] }

m.times do
  n1,n2 = gets.chomp.split(" ").map(&:to_i)
  friends[n1] << n2
  friends[n2] << n1
end

#p friends

max = 0

n.times do |i|
  up = []
  friends[i+1].each do |e|
    friends[e].each do |f|
      up << f
    end
  end
  siz = (friends[i+1]+up).uniq.size
  if max < siz
    max = siz
  end
end

p max
#puts("#{(friends[maxer]+up).uniq}")
#puts("#{(friends[maxer]+up).uniq.size}")