const main = (input) => {
  input = input.trim().split('\n')
  const [n,] = input.shift().split(' ').map(Number)
  input = Array.from(new Set(input))
  
  const friends = new Array(n+1).fill(null).map(() => [])

  for (let i=0; i<input.length; i++) {
    const [a, b] = input[i].split(' ')

    // add B to A
    if (friends[a].length) {
      for (let v=0; v<friends[a].length; v++) {
        const anotherFriendIdx = friends[a][v]
        if (!friends[anotherFriendIdx].includes(b) && b !== anotherFriendIdx) friends[anotherFriendIdx].push(b)
      }
    }
    if (!friends[a].includes(b) && a !== b) friends[a].push(b)

    // add A to B
    if (friends[b].length) {
      for (let v=0; v<friends[b].length; v++) {
        const anotherFriendIdx = friends[b][v]
        if (!friends[anotherFriendIdx].includes(a) && anotherFriendIdx !== a) friends[anotherFriendIdx].push(a)
      }
    }
    if (!friends[b].includes(a) && b !== a) friends[b].push(a)
  }

  console.log(Math.max(...friends.map(v => v.length)) + 1)
}

process.env.MYTEST
  ? (process.env.MYTEST === 'test' ? test() : main(require('fs').readFileSync('dev/stdin', 'utf8')))
  : main(require('fs').readFileSync('/dev/stdin', 'utf8'))