is amalgamation of groups associative

Given groups $G_1, G_2, G_3$ and injections $A_1 \to G_1$ and $A_1 \to G_2$ , from $A_2 \to G_2$ and $A_2 \to G_3$, let $G_1 *_{A_1} *G_2 *_{A_2} G_3$ be the amalgam formed these groups and maps. Then is it true that $G_1 *_{A_1} *G_2 *_{A_2} G_3$ is the same as (G_1 *_{A_1} G_2 ) *_{A_2} G_3. If yes, how do we see this?

-