program prob7
    implicit none
    integer, allocatable :: count(:, :)
    integer :: ans(26)
    character(len=50) :: tmp
    integer :: n, i, j, inttmp

    read(*,*) n
    allocate(count(n, 26))

    do i = 1, n
        do j = 1, 26
            count(i, j) = 0
        end do
    end do

    do i = 1, n
        read(*,*) tmp
        do j = 1, len_trim(tmp)
            inttmp = ichar(tmp(j:j)) - ichar('a') + 1
            count(i, inttmp) = count(i, inttmp) + 1
        end do
    end do

    do j = 1, 26
        inttmp = 51
        do i = 1, n
            inttmp = tmin(inttmp, count(i, j))
        end do
        ans(j) = inttmp
    end do

    do j = 1, 26
        do i = 1, ans(j)
            write(*,'(a)',advance='no') char(ichar('a') + j - 1)
        end do
    end do
    write(*,*) 

    stop
contains
integer function tmin(a,b)
    implicit none
    integer :: a,b
    if(a > b) then
        tmin = b
    else
        tmin = a
    end if    
    return
end function tmin
end program prob7