{% set ns = namespace(left=0, right=0) %}
{% for i in range(20) %}
{% if uniquePathsAt(elements, '1-' ~ i ~ '$') | length != 0 %}
{% set ns.left = i %}
{% endif %}
{% if uniquePathsAt(elements, '2-' ~ i ~ '$') | length != 0 %}
{% set ns.right = i %}
{% endif %}
{% endfor %}
{% macro item_left(index, count) -%}
{% set id = '1-'~index %}
{% if index == count %}
{% endif %}
{%- endmacro %}
{% macro item_right(index, count) -%}
{% set id = '2-'~index %}
{% if index == count %}
{% endif %}
{%- endmacro %}