def get_buffer_elements(i, data):
    """
    extracts top 3 elements from data from buffer

    returns '' if elements is not available
    """
    n = len(data)
    if i + 1 >= n:
        return data[i], '', ''
    elif i + 2 >= n:
        return data[i], data[i + 1], ''
    else:
        return data[i], data[i + 1], data[i + 2]