This paper gives a novel and compact proof that a metric graph consisting of a chain of loops of torsion order 0 is Brill-Noether general (a theorem of Cools-Draisma-Payne-Robeva), and a finite or metric graph consisting of a chain of loops of torsion order k is Hurwitz-Brill-Noether general in the sense of splitting loci (a theorem of Cook-Powell-Jensen). In fact, we prove a generalization to (metric) graphs with two marked points, that behaves well under vertex gluing. The key construction is a way to associate permutations to divisors on twice-marked graphs, simultaneously encoding the ranks of every twist of the divisor by the marked points. Vertex gluing corresponds to the Demazure product, which can be formulated via tropical matrix multiplication.