The Haglund–Haiman–Loehr theorem provides the following combinatorial formula for the modified Macdonald polynomials: \(\begin{aligned} \tilde{H}_{\mu }(X;q,t)=\sum _{\sigma : \mu \rightarrow \mathbb {P}}x^{\sigma }t^{\textsf{maj}(\sigma )}q^{\textsf{inv}(\sigma )}. \end{aligned}\) Inspired by Martin’s multiline-queue formula for the stationary distribution of multitype asymmetric simple exclusion processes, Corteel, Haglund, Mandelshtam, Mason and Williams recently introduced the queue inversion statistic \(\textsf{quinv}\) and conjectured that the tableaux formula for \(\tilde{H}_{\mu }(X;q,t)\) is invariant if the inversion statistic \(\textsf{inv}\) is replaced by \(\textsf{quinv}\) . This was subsequently resolved by Ayyer, Mandelshtam and Martin, who proposed a stronger conjecture on the equivalence of the two refined formulas for \(\tilde{H}_{\mu }(X;q,t)\) . Our main result confirms this Ayyer–Mandelshtam–Martin conjecture. We establish an equidistribution between the pairs \((\textsf{inv},\textsf{maj})\) and \((\textsf{quinv},\textsf{maj})\) of \(\mu \) -Mahonian statistics on any row-equivalency class \([\tau ]\) , where \(\tau \) is a filling of the Young diagram of \(\mu \) . As a byproduct of our approach, we show that if \(\tau \) is a rectangular filling, the triples \((\textsf{inv},\textsf{quinv},\textsf{maj})\) and \((\textsf{quinv},\textsf{inv},\textsf{maj})\) have the same distribution over \([\tau ]\) .