module vector_int32_mod
    use,intrinsic :: iso_fortran_env
    type vector
        integer(int32),allocatable:: array(:)
        integer(int32):: l
    contains
        procedure :: push_back => vector_regist
    end type

    interface vector
        module procedure vector_init
    end interface
contains
    function vector_init() result(vec)
        type(vector):: vec
        allocate(vec%array(1))
        vec%l = 0
    end function

    subroutine vector_regist(vec, v)
        class(vector):: vec
        integer(int32):: v

        if (vec%l+1 > size(vec%array)) call add_(vec)
        vec%l=vec%l+1
        vec%array(vec%l) = v
    end subroutine


    subroutine add_(vec)
        type(vector):: vec
        integer(int32),allocatable:: tmp(:)
        integer(int32):: l

        l = size(vec%array)
        allocate(tmp(l))
        tmp(:) = vec%array(:)
        deallocate(vec%array)
        allocate(vec%array(l*2))
        vec%array(1:l) = tmp(:)
        deallocate(tmp)
    end subroutine
end module

program main
    use,intrinsic :: iso_fortran_env
    use vector_int32_mod
    implicit none
    integer(int32):: n,m,i,j
    integer(int32), allocatable:: a(:),b(:)
    type(vector):: par, siz
    logical::dm

    read*, n,m

    par = vector()
    siz = vector()
    do i=1,n
        call par%push_back(i)
        call siz%push_back(1)
    end do

    allocate(a(m),b(m))
    do i=1,m
        read*, a(i), b(i)
        dm = mergee(a(i),b(i))
    end do

    print'(i0)', maxval(siz%array)




contains
    function root(x) result(ret)
        integer(int32)x,ret

        do while(par%array(x) /= x)
            x = par%array(x)
            par%array(x) = par%array(par%array(x))
        end do
        ret = x
    end function

    function mergee(x,y) result(ret)
        integer(int32):: x,y
        logical:: ret
        x = root(x)
        y = root(y)
        if (x == y) then
            ret = .false.
            return
        end if
        if (siz%array(x) < siz%array(y)) then
            siz%array(y) = siz%array(y) + siz%array(x)
            par%array(x) = y
        else
            siz%array(x) = siz%array(x) + siz%array(y)
            par%array(y) = x
        end if
    end function

    function issame(x,y) result(ret)
        integer(int32):: x,y
        logical:: ret
        ret = root(x) == root(y)
    end function

    
end program main