while(n=gets.to_i)>0
h=([0]*101).map.with_index{|n,i|[[i]]}
n.times{
a,b=gets.split.map &:to_i
h[a].push(*h[b].map{|l|l.include?(a)?[a]:[a]+l}).uniq!
h[b].push(*h[a].map{|l|l.include?(b)?[b]:[b]+l}).uniq!
}
p h.map{|i|i.map{|l|l.size}.max}.max
end