s=5{a[NR]=$0}END{i=115 for(OFS=$0=_;s>0;s=index(a[1],substr(v,3))-1){$i=substr(v=substr(a[2+$i],s,3),1,1) i+=v~/>/?1:-1}print}